diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index ccc2a8763d..5d32014938 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -96,7 +96,7 @@ jobs: ;; esac case "${path}" in - scripts/compiler_differential/*|scripts/run_compiler_differential.py|tests/*/scripts/compiler_differential/*|.github/workflows/verify.yml|Makefile) + scripts/compiler_differential/*|scripts/run_compiler_differential.py|tests/*/scripts/compiler_differential/*|tests/goldens/*|tests/e2e/fixtures/*|website/examples/*|src/sqlbuild/cli/commands/_helpers/compile/*|.github/workflows/verify.yml|Makefile) compiler_differential=true ;; esac @@ -317,7 +317,7 @@ jobs: path: ${{ runner.temp }}/compiler-differential-wheel-sites.json if-no-files-found: warn retention-days: 30 - - name: Compare generated seeds and the failure corpus (python vs shipped native) + - name: Compare fixtures, examples, generated seeds and the failure corpus (python vs shipped native) run: >- make compiler-differential-shipped COMPILER_DIFFERENTIAL_ARGS="--stage-captures --require-discovery-coverage diff --git a/Makefile b/Makefile index 8512fc21b1..2d119c858e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,8 @@ SHELL := /bin/bash test-e2e-duckdb-integrations test-e2e-performance \ test-e2e-cold-compile-performance test-e2e-cache-compile-performance \ test-e2e-dense-compile-performance test-e2e-varied-cache-performance \ - compiler-differential compiler-differential-shipped compiler-differential-dense + compiler-differential compiler-differential-shipped compiler-differential-dense \ + compiler-baselines format: uv run ruff format . @@ -293,19 +294,32 @@ COMPILER_DIFFERENTIAL_SEEDS ?= 12 COMPILER_DIFFERENTIAL_SHIPPED_SEEDS ?= 12 COMPILER_DIFFERENTIAL_DENSE_MODELS ?= 3000 COMPILER_DIFFERENTIAL_ARGS ?= +# Native-to-Python fallbacks and analysis deferrals must match the allow-list exactly, and every +# output its golden. `make compiler-baselines` rewrites both (see scripts/compiler_differential/README.md). +COMPILER_DIFFERENTIAL_GATES := --native-fallbacks check --goldens check compiler-differential: env PYTHONUNBUFFERED=1 uv run python -m scripts.run_compiler_differential \ --jobs $(COMPILER_DIFFERENTIAL_JOBS) --seeds $(COMPILER_DIFFERENTIAL_SEEDS) \ - $(COMPILER_DIFFERENTIAL_ARGS) + $(COMPILER_DIFFERENTIAL_GATES) $(COMPILER_DIFFERENTIAL_ARGS) # python vs native-preview above covers every native stage; this keeps the shipped `native` default -# (native discovery and rendering) covered on a bounded corpus. +# (native discovery and rendering) and its goldens covered on the same corpus. compiler-differential-shipped: env PYTHONUNBUFFERED=1 uv run python -m scripts.run_compiler_differential \ - --engines python native --corpus seeds failures \ + --engines python native --corpus fixtures examples seeds failures \ --jobs $(COMPILER_DIFFERENTIAL_JOBS) --seeds $(COMPILER_DIFFERENTIAL_SHIPPED_SEEDS) \ - $(COMPILER_DIFFERENTIAL_ARGS) + $(COMPILER_DIFFERENTIAL_GATES) $(COMPILER_DIFFERENTIAL_ARGS) + +# Rewrite the goldens (from the python oracle) and the fallback allow-list from both CI runs. +# Review the diff like code; see scripts/compiler_differential/README.md. +COMPILER_DIFFERENTIAL_CI_ARGS := --stage-captures --require-discovery-coverage --require-render-coverage +compiler-baselines: + rm -rf tests/goldens/compiler + $(MAKE) compiler-differential COMPILER_DIFFERENTIAL_ARGS="$(COMPILER_DIFFERENTIAL_CI_ARGS) \ + --require-analysis-coverage --native-fallbacks update --goldens update" + $(MAKE) compiler-differential-shipped COMPILER_DIFFERENTIAL_ARGS="$(COMPILER_DIFFERENTIAL_CI_ARGS) \ + --native-fallbacks update --goldens update" compiler-differential-dense: env PYTHONUNBUFFERED=1 uv run python -m scripts.run_compiler_differential \ diff --git a/scripts/compiler_differential/README.md b/scripts/compiler_differential/README.md new file mode 100644 index 0000000000..20a0a1e65e --- /dev/null +++ b/scripts/compiler_differential/README.md @@ -0,0 +1,147 @@ +# Compiler differential + +`make compiler-differential` compiles fixtures, examples, generated seeds and the failure corpus +under two compiler engines and fails on the first differing artifact. `make +compiler-differential-shipped` does the same for the shipped `native` default. Both also enforce +the shared gates below. + +For ad hoc runs (one project, other seeds, other engines), call the script directly, for example +`uv run python -m scripts.run_compiler_differential --corpus --project --engines python +native`. The make targets fix the corpus the allow-list and goldens are recorded for. + +## Shared gates for native ports + +A port that moves work from the Python compiler to native code reuses these three mechanisms. It +does not add its own parity harness, property suite or E2E file. + +### Native-to-Python fallbacks and analysis deferrals + +`native_fallbacks.toml` is the one allow-list of all work native code still hands back to Python, +and of the work each native stage answers itself. It covers three kinds of record: +- fallbacks, from `report_native_fallback(site=NativeFallbackSite., kind=...)` on every + path where a native stage hands work to Python, or runs Python with no native path yet; +- preview analysis-stage deferrals: every `analysis-deferrals-*.jsonl` record (analysis session, + lineage, semantic checks, contracts); +- native answers, from `report_native_answer(stage=NativeStage., kind=...)` where a + stage's native path produced the result: files, models, scans or calls. Their site is + `.native`. + +Counting only fallbacks cannot tell a stage that answers natively from one that no longer runs +natively at all. The answer counts can: if a stage is switched to Python, its `.native` +entries vanish and the gate says so. + +Every entry names an engine, stage, site and kind, with its exact count per corpus. Use +`max_counts` instead of `counts` only for a count that is not stable, and give the reason in a +comment and in the PR body. + +The records cost nothing unless `SQLBUILD_ANALYSIS_RECORD_DIR` is set, which only the harness +sets. `--native-fallbacks check` runs in both make targets and fails CI in both directions: +- an entry, engine or corpus count that is not on the list fails; +- a listed entry whose count changed or that no longer occurs also fails, and the message says to + update or remove it, so the fallback list only shrinks; +- a vanished native answer fails as work that now runs in Python; +- a listed fallback that vanished is refused outright, with "fallback disappeared but native + answers did not appear; the stage may be switched off", unless the same engine, stage and + corpus report more `.native` answers than the list records. A stage with only fallback + entries (`sql_test_glue`, `project_assembly`) would otherwise look like a finished port when it + is switched off. + +The counts hold for the make targets' corpus (`--seeds 12`); other seed ranges are refused. + +Two stages the list cannot watch: +- `type_system`: the compile corpus never reaches type normalization. Its callers are the planner + and executor and the preview stages' Python fallbacks. `tests/integration/.../type_system/ + test_native_type_parity.py` proves instead that the public `normalize_type` asks native first + under `native-preview`. +- `discovery.native model_file_listings`: it is reported unconditionally inside the native model + file discovery, which has no fallback to Python, so this count cannot detect anything. It stays + only as a record that native discovery ran. + +**How a PR updates the list and the goldens** + +One command rewrites both from the current tree: + +```sh +make compiler-baselines +``` + +It deletes `tests/goldens/compiler`, then runs the two CI differentials with `--native-fallbacks +update --goldens update`. Commit the resulting `native_fallbacks.toml` and `tests/goldens/` diff +in the same PR as the change that caused it. + +- A port deletes the Python code it replaces in the same PR. Its fallback entries then disappear + from the list, and that removal is the port's test that the fallbacks are gone. Its answer + counts usually rise. When the last entry for a `NativeFallbackSite` goes, delete the member + and its `report_native_fallback` call too. +- If the corpus does not reach a site yet, first add a failure case or seed feature that does. +- A PR that merges after a list or golden change on main reruns `make compiler-baselines` after + rebasing and commits the result. + +**What a reviewer checks in the diff** + +- `native_fallbacks.toml`: + - Removed fallback entries and lower fallback counts are expected from ports. + - Every added fallback entry, higher fallback count or new `max_counts` needs a stated reason + in the PR body. Never add one just to make CI pass. + - A removed or lower `.native` answer count means less native work. It needs a reason + in the PR body. + - A removed fallback entry needs new or higher `.native` answers for the same stage in the + same diff: the port must report the work it now answers. A fallback that vanished with no new + answers is a stage switched off, not a port; the gate refuses it. +- Code: every new path that hands work to Python calls `report_native_fallback`, and every new + native path calls `report_native_answer` where its result is used. +- Goldens: + - Every changed golden is an intended output change, named in the PR body. + - An output-neutral port changes no golden. + - New goldens belong to new corpus cases. +- Proof by sabotage: `test_native_fallback_gate.py` proves the gate by sabotage, so forcing a + native stage to defer everything must fail it. A new "native did the work" gate needs the same + proof. + +### Golden outputs + +`tests/goldens/compiler//.json` holds one project's compile outputs: +- each command's exit code and diagnostics; +- the compiled SQL, one array item per line; +- the manifest without its volatile metadata and the SQL it repeats. + +The project directory is masked as `` and the harness work directory as ``, +whether or not the path is resolved. The SQLBuild version, invocation ids and timings are also +masked. + +Goldens hold outputs only, not stage captures: a seed's captures are about 690 KB, too large to +review. Cache facts are covered by the incremental-versus-no-cache tests instead. + +- `--goldens check` (in both make targets) compares every engine with the goldens, so an + output-neutral port needs no new parity suite. +- `make compiler-baselines` rewrites them from the python oracle. Run it only when output + changes on purpose, and review the diff like code. +- `tests/goldens/compiler/seed_range.toml` records the seed range the goldens were written for. + Every seed in that range, and every fixture, example and failure case, must have a golden. + Seeds outside the range (ad hoc runs with more seeds) are skipped. A missing `seed_range.toml` + fails the check for every seed project rather than skipping them. +- Dialect variants (`-postgres`, `-snowflake`) are generated for the first seed of a + run only, so a golden is required only for the variants of the recorded `seed_start`. An ad hoc + `--seed-start N` run checks its base seeds in the range and skips its variants. +- Once the Python stages are deleted, goldens are rewritten from `native`. + +### All-engine user-facing errors + +`engine_error_cases()` in `_helpers/corpus/failure_cases.py` lists user-facing errors with their +exact text. Each case is part of the failure corpus, so it runs in both differentials and has a +golden. It also runs in +`tests/e2e/scripts/compiler_differential/test_engine_error_cases.py` on the `python`, `native` +and `native-preview` engines, which must all report its `expected_code` and `expected_message`. + +A port that adds or changes a user-facing error adds one `failure_case(...)` to it: + +```python +failure_case( + name="engine-error-", + expected_code="P001", + files=mart_body_files("SELECT ...\n"), + expected_message=" for the project path>", +) +``` + +Then it runs `make compiler-baselines` to record the new case's golden. diff --git a/scripts/compiler_differential/_helpers/comparing/project_comparison.py b/scripts/compiler_differential/_helpers/comparing/project_comparison.py index ac14b3d1fd..8ab9cd2697 100644 --- a/scripts/compiler_differential/_helpers/comparing/project_comparison.py +++ b/scripts/compiler_differential/_helpers/comparing/project_comparison.py @@ -13,6 +13,10 @@ from scripts.compiler_differential._helpers.coverage.analysis import project_analysis_kinds from scripts.compiler_differential._helpers.coverage.discovery import project_discovery_kinds from scripts.compiler_differential._helpers.coverage.render import project_render_kinds +from scripts.compiler_differential._helpers.goldens.goldens import ( + golden_differences, + golden_path_masks, +) from scripts.compiler_differential._helpers.running.execution import run_engine from scripts.compiler_differential.constants import ( ERROR_SEVERITY, @@ -64,6 +68,17 @@ def compare_project(*, project: CorpusProject, options: DifferentialOptions) -> *_timeout_differences(project=project, runs=(left, right)), *_corpus_differences(project=project, run=left), *compare_engine_runs(project=project.name, left=left, right=right), + *( + golden_differences( + project=project, + runs=(left, right), + golden_dir=options.golden_dir, + mode=options.golden_mode, + masked_paths=golden_path_masks(case_dir=case_dir, work_dir=options.work_dir), + ) + if options.golden_mode is not None and options.golden_dir is not None + else () + ), ] return ProjectComparison( project=project.name, diff --git a/scripts/compiler_differential/_helpers/corpus/emitted_codes.py b/scripts/compiler_differential/_helpers/corpus/emitted_codes.py index c7c2af8612..4bfc505a39 100644 --- a/scripts/compiler_differential/_helpers/corpus/emitted_codes.py +++ b/scripts/compiler_differential/_helpers/corpus/emitted_codes.py @@ -12,9 +12,11 @@ first_diagnostic_message, ) from scripts.compiler_differential._helpers.corpus.corpus import build_corpus +from scripts.compiler_differential._helpers.goldens.goldens import golden_path_masks, masked_text from scripts.compiler_differential._helpers.running.execution import run_engine from scripts.compiler_differential.constants import ( ANALYSIS_CODE_SCAN_ROOTS, + COLD_COMPILE, CORPUS_FAILURES, DIAGNOSTIC_CODE_PATTERN, ERROR_SEVERITY, @@ -29,6 +31,8 @@ DifferentialOptions, EmittedCodes, EngineRun, + ExpectedOutcome, + FailureCase, ) from sqlbuild.compiler.auditing.constants import BUILT_IN_AUDIT_SHADOW_CODE from sqlbuild.compiler.compile import constants as compile_constants @@ -60,6 +64,20 @@ def emitted_failure_codes(*, options: DifferentialOptions) -> dict[str, EmittedC return {project.name: codes for project, codes in zip(corpus, emitted, strict=True)} +def case_emitted_codes(*, case: FailureCase, options: DifferentialOptions) -> EmittedCodes: + """Compile one failure case under the first engine and return what it really emitted.""" + + return _emitted_codes( + project=CorpusProject( + name=f"{CORPUS_FAILURES}/{case.name}", + commands=(COLD_COMPILE,), + expected=ExpectedOutcome(error_code=case.expected_code), + writer=case.write, + ), + options=options, + ) + + def discovery_error_codes() -> frozenset[str]: """Return the code of every `DiscoveryError` subclass, walking the whole hierarchy.""" @@ -182,14 +200,20 @@ def _emitted_codes(*, project: CorpusProject, options: DifferentialOptions) -> E options=options, ) first: dict[str, object] = first_diagnostic(outcome=run.outcomes[0], severity=ERROR_SEVERITY) + message: str | None = first_diagnostic_message(outcome=run.outcomes[0], severity=ERROR_SEVERITY) notes: object = first.get("notes") line: object = first.get("line") column: object = first.get("column") return EmittedCodes( errors=diagnostic_codes(outcome=run.outcomes[0], severity=ERROR_SEVERITY), warnings=diagnostic_codes(outcome=run.outcomes[0], severity=WARNING_SEVERITY), - first_error_message=first_diagnostic_message( - outcome=run.outcomes[0], severity=ERROR_SEVERITY + first_error_message=( + None + if message is None + else masked_text( + text=message, + masks=golden_path_masks(case_dir=case_dir, work_dir=options.work_dir), + ) ), first_error_help=None if first.get("help") is None else str(first.get("help")), first_error_notes=tuple(str(note) for note in notes) if isinstance(notes, list) else (), diff --git a/scripts/compiler_differential/_helpers/corpus/failure_cases.py b/scripts/compiler_differential/_helpers/corpus/failure_cases.py index c22ae06ca7..ed800bcd5f 100644 --- a/scripts/compiler_differential/_helpers/corpus/failure_cases.py +++ b/scripts/compiler_differential/_helpers/corpus/failure_cases.py @@ -36,6 +36,8 @@ ) from scripts.compiler_differential.models import FailureCase +_MART_HEADER_START: str = 'MODEL (\n description "Order totals per customer",\n' + _RULES_CONFIG: str = '\n[rules]\nselect = ["{codes}"]\n' @@ -57,6 +59,7 @@ def all_failure_cases() -> tuple[FailureCase, ...]: *reference_failure_cases(), *attachment_failure_cases(), *analysis_failure_cases(), + *engine_error_cases(), ) @@ -591,3 +594,51 @@ def _compile_failure_cases() -> tuple[FailureCase, ...]: ), ), ) + + +def engine_error_cases() -> tuple[FailureCase, ...]: + """User-facing errors every engine must report with the exact text; see the README.""" + + return ( + failure_case( + name="engine-error-unset-environment-variable", + expected_code="P001", + files=mart_body_files( + "SELECT customer_id, '@@ENV:SQB_ENGINE_ERROR_UNSET_REGION' AS region\n" + 'FROM __ref("stg_orders")\n' + ), + expected_message=( + "unknown environment variable '@@ENV:SQB_ENGINE_ERROR_UNSET_REGION' in " + f"'/{FAILURE_MART_PATH}'" + ), + ), + failure_case( + name="engine-error-case-folded-duplicate-column", + expected_code="P001", + files={ + FAILURE_MART_PATH: _MART_HEADER_START + + ' columns (\n Größe (description "Size"),\n' + + ' größe (description "Size again"),\n ),\n);\n\n' + + 'SELECT customer_id AS größe\nFROM __ref("stg_orders")\n' + }, + expected_message=( + f"{FAILURE_MART_PATH} model has duplicate column 'größe' " + "(column names are case-insensitive)" + ), + ), + failure_case( + name="engine-error-week-date-cursor-start", + expected_code="P001", + files={ + FAILURE_MART_PATH: _MART_HEADER_START + + " materialized incremental,\n incremental_strategy append,\n" + + " cursor order_ts,\n cursor_type timestamp,\n cursor_grain day,\n" + + ' cursor_start "2024-W01-1T25:00",\n);\n\n' + + 'SELECT customer_id, CURRENT_TIMESTAMP AS order_ts\nFROM __ref("stg_orders")\n' + }, + expected_message=( + "model 'customer_totals': cursor_start value '2024-W01-1T25:00' is not a valid " + "ISO timestamp: hour must be in 0..23" + ), + ), + ) diff --git a/scripts/compiler_differential/_helpers/goldens/__init__.py b/scripts/compiler_differential/_helpers/goldens/__init__.py new file mode 100644 index 0000000000..3da85fcf6d --- /dev/null +++ b/scripts/compiler_differential/_helpers/goldens/__init__.py @@ -0,0 +1 @@ +"""Golden compile outputs for the shipped native stages.""" diff --git a/scripts/compiler_differential/_helpers/goldens/goldens.py b/scripts/compiler_differential/_helpers/goldens/goldens.py new file mode 100644 index 0000000000..e5e2d3f837 --- /dev/null +++ b/scripts/compiler_differential/_helpers/goldens/goldens.py @@ -0,0 +1,239 @@ +"""Golden compile outputs: one reviewable JSON file per corpus project, checked or rewritten.""" + +from __future__ import annotations + +import json +import tomllib +from importlib.metadata import version +from pathlib import Path + +from scripts.compiler_differential._helpers.comparing.compare import ( + as_json_object, + first_json_difference, +) +from scripts.compiler_differential._helpers.comparing.normalize import ( + normalize_artifact_text, + normalize_stderr, +) +from scripts.compiler_differential.constants import ( + GOLDEN_CORPUS_PREFIXES, + GOLDEN_LABEL, + GOLDEN_MANIFEST_DROPPED_KEYS, + GOLDEN_MANIFEST_RESOURCE_SECTIONS, + GOLDEN_MISSING_HINT, + GOLDEN_MODE_CHECK, + GOLDEN_PATH_MASK, + GOLDEN_RESOURCE_DROPPED_FIELDS, + GOLDEN_SEED_CORPUS, + GOLDEN_SEED_RANGE_FILE, + GOLDEN_SUFFIX, + GOLDEN_VERSION_MASK, + GOLDEN_WORK_MASK, + PROJECT_DIRECTORY, +) +from scripts.compiler_differential.models import ( + CommandOutcome, + CorpusProject, + Difference, + Divergence, + EngineRun, +) + +_SQLBUILD_VERSION: str = version("sqlbuild") + + +def golden_differences( + *, + project: CorpusProject, + runs: tuple[EngineRun, ...], + golden_dir: Path, + mode: str, + masked_paths: tuple[tuple[str, str], ...], +) -> list[Difference]: + """Check every run against the project's golden, or rewrite it from the first (oracle) run.""" + + path: Path | None = golden_path(golden_dir=golden_dir, project=project.name) + if path is None: + return [] + payloads: list[dict[str, object]] = [ + golden_payload(run=run, masked_paths=masked_paths) for run in runs + ] + if mode != GOLDEN_MODE_CHECK: + path.parent.mkdir(parents=True, exist_ok=True) + _ = path.write_text(golden_text(payloads[0]), encoding="utf-8") + return [] + seed_range: Path = golden_dir / GOLDEN_SEED_RANGE_FILE + if path.parent.name == GOLDEN_SEED_CORPUS and not seed_range.is_file(): + return [ + Difference( + project=project.name, + artifact=f"golden {seed_range.name}", + location="file", + left="", + right=GOLDEN_MISSING_HINT, + labels=(GOLDEN_LABEL, "hint"), + ) + ] + if not path.is_file(): + if path.parent.name == GOLDEN_SEED_CORPUS and not _seed_in_recorded_range( + seed_range=seed_range, name=path.stem + ): + return [] + return [ + Difference( + project=project.name, + artifact=f"golden {path.name}", + location="file", + left="", + right=GOLDEN_MISSING_HINT, + labels=(GOLDEN_LABEL, "hint"), + ) + ] + golden: object = json.loads(path.read_text(encoding="utf-8")) + found: list[Difference] = [] + for run, payload in zip(runs, payloads, strict=True): + divergence: Divergence | None = first_json_difference(left=golden, right=payload) + if divergence is not None: + found.append( + Difference( + project=project.name, + artifact=f"golden ({run.engine})", + location=divergence.location, + left=divergence.left, + right=divergence.right, + labels=(GOLDEN_LABEL, run.engine), + ) + ) + return found + + +def golden_path(*, golden_dir: Path, project: str) -> Path | None: + """Where a corpus project's golden lives; projects outside the golden corpora have none.""" + + corpus, _, name = project.partition("/") + if corpus not in GOLDEN_CORPUS_PREFIXES or not name: + return None + return golden_dir / corpus / f"{name}{GOLDEN_SUFFIX}" + + +def golden_payload( + *, run: EngineRun, masked_paths: tuple[tuple[str, str], ...] +) -> dict[str, object]: + """Return a run's diagnostics, compiled SQL and slimmed manifest with run noise masked.""" + + return { + "commands": [ + _command(outcome=outcome, masked_paths=masked_paths) for outcome in run.outcomes + ], + "compiled": { + path: _lines( + text=_masked( + text=contents.decode("utf-8", "surrogateescape"), masked_paths=masked_paths + ) + ) + for path, contents in sorted(run.compiled.items()) + }, + "manifest": _manifest(text=run.manifest, masked_paths=masked_paths), + } + + +def golden_text(payload: dict[str, object]) -> str: + """Serialize a golden with one value per line so a changed output reads as a small diff.""" + + return json.dumps(payload, indent=1, ensure_ascii=False) + "\n" + + +def _command( + *, outcome: CommandOutcome, masked_paths: tuple[tuple[str, str], ...] +) -> dict[str, object]: + stdout: str = _masked(text=outcome.stdout, masked_paths=masked_paths) + try: + report: dict[str, object] | None = as_json_object(json.loads(stdout)) + except json.JSONDecodeError: + report = None + return { + "label": outcome.label, + "exit_code": "timed out" if outcome.timed_out else outcome.exit_code, + "diagnostics": ( + report.get("diagnostics", []) + if report is not None + else _lines( + text=normalize_stderr(_masked(text=outcome.stderr, masked_paths=masked_paths)) + ) + ), + } + + +def _manifest(*, text: str | None, masked_paths: tuple[tuple[str, str], ...]) -> object | None: + if text is None: + return None + manifest: dict[str, object] = ( + as_json_object(json.loads(_masked(text=text, masked_paths=masked_paths))) or {} + ) + kept: dict[str, object] = { + key: value for key, value in manifest.items() if key not in GOLDEN_MANIFEST_DROPPED_KEYS + } + for section in GOLDEN_MANIFEST_RESOURCE_SECTIONS: + resources: dict[str, object] = as_json_object(kept.get(section)) or {} + kept[section] = {name: _without_code(resource) for name, resource in resources.items()} + return kept + + +def _without_code(resource: object) -> object: + fields: dict[str, object] | None = as_json_object(resource) + if fields is None: + return resource + return { + key: value for key, value in fields.items() if key not in GOLDEN_RESOURCE_DROPPED_FIELDS + } + + +def _masked(*, text: str, masked_paths: tuple[tuple[str, str], ...]) -> str: + text = masked_text(text=text, masks=masked_paths) + return normalize_artifact_text(text).replace(_SQLBUILD_VERSION, GOLDEN_VERSION_MASK) + + +def _lines(*, text: str) -> list[str]: + return text.split("\n") + + +def write_golden_seed_range(*, golden_dir: Path, seed_start: int, seeds: int) -> None: + """Record the seed range the goldens hold; every seed in it must keep its golden.""" + + golden_dir.mkdir(parents=True, exist_ok=True) + _ = (golden_dir / GOLDEN_SEED_RANGE_FILE).write_text( + f"seed_start = {seed_start}\nseeds = {seeds}\n", encoding="utf-8" + ) + + +def _seed_in_recorded_range(*, seed_range: Path, name: str) -> bool: + """Seeds in the recorded range need goldens; dialect variants only for its first seed.""" + + recorded: dict[str, object] = tomllib.loads(seed_range.read_text(encoding="utf-8")) + start: int = int(str(recorded.get("seed_start", 0))) + seed, _, dialect = name.partition("-") + index: int = int(seed) + if dialect: + return index == start + return start <= index < start + int(str(recorded.get("seeds", 0))) + + +def golden_path_masks(*, case_dir: Path, work_dir: Path) -> tuple[tuple[str, str], ...]: + """`(path, token)` for the project and work directories, resolved or not, longest first.""" + + workspace: Path = case_dir / PROJECT_DIRECTORY + masks: set[tuple[str, str]] = { + (str(workspace), GOLDEN_PATH_MASK), + (str(workspace.resolve()), GOLDEN_PATH_MASK), + (str(work_dir), GOLDEN_WORK_MASK), + (str(work_dir.resolve()), GOLDEN_WORK_MASK), + } + return tuple(sorted(masks, key=lambda mask: (-len(mask[0]), mask[0]))) + + +def masked_text(*, text: str, masks: tuple[tuple[str, str], ...]) -> str: + """Replace every masked path with its token, longest path first.""" + + for path, token in masks: + text = text.replace(path, token) + return text diff --git a/scripts/compiler_differential/_helpers/running/native_fallbacks.py b/scripts/compiler_differential/_helpers/running/native_fallbacks.py new file mode 100644 index 0000000000..b9d50c366f --- /dev/null +++ b/scripts/compiler_differential/_helpers/running/native_fallbacks.py @@ -0,0 +1,246 @@ +"""The one allow-list of native-to-Python fallbacks and analysis deferrals, checked or rewritten.""" + +from __future__ import annotations + +import tomllib +from collections import Counter +from pathlib import Path + +from scripts.compiler_differential.constants import ( + CORPUS_SEEDS, + NATIVE_FALLBACK_ANSWER_SUFFIX, + NATIVE_FALLBACK_COUNTS_FIELD, + NATIVE_FALLBACK_DEFERRAL_STAGES, + NATIVE_FALLBACK_DEFERRAL_UNKNOWN_STAGE, + NATIVE_FALLBACK_LIST_HEADER, + NATIVE_FALLBACK_MAX_COUNTS_FIELD, + NATIVE_FALLBACK_MODE_UPDATE, + NATIVE_FALLBACK_PROJECT_CORPUS, + NATIVE_FALLBACK_SITE_SEPARATOR, +) +from scripts.compiler_differential.models import ( + AllowList, + FallbackGateRequest, + ProjectComparison, + RecordedRun, +) +from scripts.compiler_differential.types import FallbackKey + + +def native_fallback_gate( + *, request: FallbackGateRequest | None, comparisons: list[ProjectComparison] +) -> tuple[str, ...]: + """Check the run against the allow-list, or rewrite it; print and return every problem.""" + + if request is None: + return () + observed: dict[FallbackKey, dict[str, int]] = observed_fallbacks( + comparisons=comparisons, engines=request.run.engines + ) + if request.mode == NATIVE_FALLBACK_MODE_UPDATE: + write_allow_list(path=request.allow_list, observed=observed, run=request.run) + print(f"Native fallback allow-list rewritten: {request.allow_list}") + return () + problems: list[str] = fallback_problems( + observed=observed, allowed=read_allow_list(request.allow_list), run=request.run + ) + for problem in problems: + print(f"Native fallback allow-list: {problem}") + return tuple(problems) + + +def observed_fallbacks( + *, comparisons: list[ProjectComparison], engines: tuple[str, ...] +) -> dict[FallbackKey, dict[str, int]]: + """Sum every engine's fallback and analysis deferral records by entry and corpus.""" + + counts: Counter[tuple[FallbackKey, str]] = Counter() + for comparison in comparisons: + corpus: str = comparison.project.split("/", 1)[0] + for engine, records in zip(engines, comparison.records or (), strict=False): + for (site, kind), count in records.fallbacks.items(): + stage: str = site.split(NATIVE_FALLBACK_SITE_SEPARATOR, 1)[0] + counts[((engine, stage, site, kind), corpus)] += count + for (kind, site), count in records.deferrals.items(): + stage = NATIVE_FALLBACK_DEFERRAL_STAGES.get( + site, NATIVE_FALLBACK_DEFERRAL_UNKNOWN_STAGE + ) + counts[((engine, stage, site, kind), corpus)] += count + observed: dict[FallbackKey, dict[str, int]] = {} + for (key, corpus), count in sorted(counts.items()): + observed.setdefault(key, {})[corpus] = count + return observed + + +def read_allow_list(path: Path) -> AllowList: + """Parse the allow-list file; a missing file allows nothing.""" + + if not path.is_file(): + return AllowList(seed_start=0, seeds=0, counts={}, max_counts={}) + document: dict[str, object] = tomllib.loads(path.read_text(encoding="utf-8")) + counts: dict[FallbackKey, dict[str, int]] = {} + max_counts: dict[FallbackKey, dict[str, int]] = {} + entries: object = document.get("entry", []) + for entry in entries if isinstance(entries, list) else []: + key: FallbackKey = ( + str(entry["engine"]), + str(entry["stage"]), + str(entry["site"]), + str(entry["kind"]), + ) + bounded: bool = NATIVE_FALLBACK_MAX_COUNTS_FIELD in entry + field: str = NATIVE_FALLBACK_MAX_COUNTS_FIELD if bounded else NATIVE_FALLBACK_COUNTS_FIELD + target: dict[FallbackKey, dict[str, int]] = max_counts if bounded else counts + target[key] = {str(name): int(value) for name, value in entry[field].items()} + return AllowList( + seed_start=int(str(document.get("seed_start", 0))), + seeds=int(str(document.get("seeds", 0))), + counts=counts, + max_counts=max_counts, + ) + + +def fallback_problems( + *, observed: dict[FallbackKey, dict[str, int]], allowed: AllowList, run: RecordedRun +) -> list[str]: + """Every way the run's records differ from the allow-list, as instructions to the author.""" + + if CORPUS_SEEDS in run.corpora and (run.seed_start, run.seeds) != ( + allowed.seed_start, + allowed.seeds, + ): + return [ + f"the allow-list holds counts for --seed-start {allowed.seed_start} --seeds " + f"{allowed.seeds}; this run used --seed-start {run.seed_start} --seeds {run.seeds}" + ] + corpora: frozenset[str] = _corpus_prefixes(run.corpora) + observed_answers: Counter[tuple[str, str, str]] = _answer_totals(observed) + allowed_answers: Counter[tuple[str, str, str]] = _answer_totals( + {**allowed.counts, **allowed.max_counts} + ) + problems: list[str] = [] + for key in sorted({*allowed.counts, *allowed.max_counts, *observed}): + if key[0] not in run.engines: + continue + actual: dict[str, int] = observed.get(key, {}) + exact: dict[str, int] | None = allowed.counts.get(key) + bound: dict[str, int] | None = allowed.max_counts.get(key) + for corpus in sorted({*actual, *(exact or {}), *(bound or {})} & corpora): + problem: str | None = _corpus_problem( + label=_label(key=key, corpus=corpus), + answer=key[2].endswith(NATIVE_FALLBACK_ANSWER_SUFFIX), + actual=actual.get(corpus, 0), + exact=None if exact is None else exact.get(corpus, 0), + bound=None if bound is None else bound.get(corpus, 0), + answers_rose=observed_answers[(key[0], key[1], corpus)] + > allowed_answers[(key[0], key[1], corpus)], + ) + if problem is not None: + problems.append(problem) + return problems + + +def write_allow_list( + *, path: Path, observed: dict[FallbackKey, dict[str, int]], run: RecordedRun +) -> None: + """Record the run's counts, keeping entries for engines and corpora this run did not cover.""" + + previous: AllowList = read_allow_list(path) + covered: frozenset[str] = _corpus_prefixes(run.corpora) + counts: dict[FallbackKey, dict[str, int]] = {} + for key, by_corpus in previous.counts.items(): + kept: dict[str, int] = { + corpus: count + for corpus, count in by_corpus.items() + if key[0] not in run.engines or corpus not in covered + } + if kept: + counts[key] = kept + for key, by_corpus in observed.items(): + if key[0] in run.engines and key not in previous.max_counts: + counts[key] = {**counts.get(key, {}), **by_corpus} + entries: list[tuple[FallbackKey, str, dict[str, int]]] = [ + *((key, NATIVE_FALLBACK_COUNTS_FIELD, values) for key, values in counts.items()), + *( + (key, NATIVE_FALLBACK_MAX_COUNTS_FIELD, values) + for key, values in previous.max_counts.items() + ), + ] + seeded: bool = CORPUS_SEEDS in run.corpora + lines: list[str] = [ + NATIVE_FALLBACK_LIST_HEADER, + f"seed_start = {run.seed_start if seeded else previous.seed_start}", + f"seeds = {run.seeds if seeded else previous.seeds}", + ] + for (engine, stage, site, kind), field, values in sorted(entries): + inline: str = ", ".join(f"{corpus} = {count}" for corpus, count in sorted(values.items())) + lines.extend( + ( + "", + "[[entry]]", + f'engine = "{engine}"', + f'stage = "{stage}"', + f'site = "{site}"', + f'kind = "{kind}"', + f"{field} = {{ {inline} }}", + ) + ) + _ = path.write_text("\n".join(lines) + "\n", encoding="utf-8") + + +def _corpus_problem( + *, + label: str, + answer: bool, + actual: int, + exact: int | None, + bound: int | None, + answers_rose: bool, +) -> str | None: + if answer and exact is None and bound is None: + return f"{label}: native answered {actual}, not on the allow-list; record it" + if answer and actual == 0: + return ( + f"{label}: native no longer answers here, so this work now runs in Python; " + "restore the native path, or record the change with a reason" + ) + if exact is None and bound is None: + return f"{label}: {actual} not on the allow-list; port it or list it with a reason" + if actual == 0 and not answers_rose: + return ( + f"{label}: fallback disappeared but native answers did not appear; the stage may be " + "switched off. A port that removes a fallback must report native answers for the " + "work it now does" + ) + if actual == 0: + return f"{label}: listed but no longer occurs; remove it from the allow-list" + if bound is not None: + return None if actual <= bound else f"{label}: {actual} exceeds the allowed {bound}" + if actual != exact: + return f"{label}: {actual} where the allow-list expects {exact}; update the count" + return None + + +def _answer_totals( + entries: dict[FallbackKey, dict[str, int]], +) -> Counter[tuple[str, str, str]]: + """Native answer counts summed by engine, stage and corpus.""" + + totals: Counter[tuple[str, str, str]] = Counter() + for (engine, stage, site, _), by_corpus in entries.items(): + for corpus, count in by_corpus.items(): + totals[(engine, stage, corpus)] += count * site.endswith(NATIVE_FALLBACK_ANSWER_SUFFIX) + return totals + + +def _label(*, key: FallbackKey, corpus: str) -> str: + engine, stage, site, kind = key + return f"{engine} {stage} {site} {kind} ({corpus})" + + +def _corpus_prefixes(corpora: tuple[str, ...]) -> frozenset[str]: + """Project-name prefixes of the selected corpora (`seeds` names projects `seed/...`).""" + + return frozenset( + {*(corpus.removesuffix("s") for corpus in corpora), NATIVE_FALLBACK_PROJECT_CORPUS} + ) diff --git a/scripts/compiler_differential/_helpers/running/records.py b/scripts/compiler_differential/_helpers/running/records.py index b1ab9e0145..9cecee24f2 100644 --- a/scripts/compiler_differential/_helpers/running/records.py +++ b/scripts/compiler_differential/_helpers/running/records.py @@ -1,4 +1,4 @@ -"""Read the debug analysis records one engine's processes wrote: wheel call sites and deferrals.""" +"""Read the debug records one engine's processes wrote: wheel sites, deferrals and fallbacks.""" from __future__ import annotations @@ -10,16 +10,18 @@ from scripts.compiler_differential._helpers.comparing.compare import as_json_object from scripts.compiler_differential.constants import ( ANALYSIS_DEFERRAL_RECORD_PREFIX, + NATIVE_FALLBACK_RECORD_PREFIX, WHEEL_SITE_RECORD_PREFIX, ) from scripts.compiler_differential.models import AnalysisRecords, ProjectComparison def read_analysis_records(root: Path) -> AnalysisRecords: - """Sum every process's wheel-site counts and `{"kind", "site"}` deferral lines below `root`.""" + """Sum every process's wheel-site, deferral and native-fallback records below `root`.""" sites: Counter[tuple[str, str]] = Counter() deferrals: Counter[tuple[str, str]] = Counter() + fallbacks: Counter[tuple[str, str]] = Counter() for path in sorted(root.rglob(f"{WHEEL_SITE_RECORD_PREFIX}*.json")) if root.is_dir() else (): payload: dict[str, object] = as_json_object(json.loads(path.read_text("utf-8"))) or {} rows: object = payload.get("calls") @@ -32,18 +34,29 @@ def read_analysis_records(root: Path) -> AnalysisRecords: for line in path.read_text("utf-8").splitlines(): record: dict[str, object] = as_json_object(json.loads(line)) or {} deferrals[(str(record.get("kind")), str(record.get("site")))] += 1 - return AnalysisRecords(wheel_sites=dict(sites), deferrals=dict(deferrals)) + for path in ( + sorted(root.rglob(f"{NATIVE_FALLBACK_RECORD_PREFIX}*.json")) if root.is_dir() else () + ): + payload = as_json_object(json.loads(path.read_text("utf-8"))) or {} + rows = payload.get("fallbacks") + for row in rows if isinstance(rows, list) else (): + site, kind, count = cast(list[object], row) + fallbacks[(str(site), str(kind))] += int(str(count)) + return AnalysisRecords( + wheel_sites=dict(sites), deferrals=dict(deferrals), fallbacks=dict(fallbacks) + ) def wheel_site_report( *, comparisons: list[ProjectComparison], engines: tuple[str, str] ) -> dict[str, object]: - """Return wheel calls per engine, site and API, split by corpus, plus deferral counts.""" + """Return wheel calls, deferrals and native fallbacks per engine, split by corpus.""" report: dict[str, object] = {} for side, engine in enumerate(engines): sites: dict[str, dict[str, int]] = {} deferrals: dict[str, dict[str, int]] = {} + fallbacks: dict[str, dict[str, int]] = {} for comparison in comparisons: records: AnalysisRecords | None = ( comparison.records[side] if comparison.records else None @@ -57,15 +70,19 @@ def wheel_site_report( for (kind, site), count in records.deferrals.items(): by_corpus = deferrals.setdefault(f"{kind} {site}", {}) by_corpus[corpus] = by_corpus.get(corpus, 0) + count + for (site, kind), count in records.fallbacks.items(): + by_corpus = fallbacks.setdefault(f"{site} {kind}", {}) + by_corpus[corpus] = by_corpus.get(corpus, 0) + count report[engine] = { "wheel_sites": dict(sorted(sites.items())), "deferrals": dict(sorted(deferrals.items())), + "native_fallbacks": dict(sorted(fallbacks.items())), } return report def format_wheel_site_report(report: dict[str, object]) -> str: - """Render the wheel-site and deferral counts for the run log; nothing here gates.""" + """Render the wheel-site, deferral and fallback counts for the run log; nothing here gates.""" lines: list[str] = [] for engine, raw in report.items(): @@ -73,6 +90,7 @@ def format_wheel_site_report(report: dict[str, object]) -> str: for label, key in ( ("Polyglot wheel calls", "wheel_sites"), ("Analysis deferrals", "deferrals"), + ("Native-to-Python fallbacks", "native_fallbacks"), ): counts: dict[str, object] = as_json_object(entry.get(key)) or {} lines.append(f"{label} ({engine}): {'none recorded' if not counts else ''}".rstrip()) @@ -82,3 +100,14 @@ def format_wheel_site_report(report: dict[str, object]) -> str: total: int = sum(int(str(count)) for count in corpora.values()) lines.append(f" {total:>7} {name} ({split})") return "\n".join(lines) + + +def write_wheel_site_report( + *, path: Path, comparisons: list[ProjectComparison], engines: tuple[str, str] +) -> None: + """Write the wheel-site, deferral and fallback counts to `path` as JSON and print them.""" + + report: dict[str, object] = wheel_site_report(comparisons=comparisons, engines=engines) + path.parent.mkdir(parents=True, exist_ok=True) + _ = path.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8") + print(format_wheel_site_report(report)) diff --git a/scripts/compiler_differential/_helpers/running/report.py b/scripts/compiler_differential/_helpers/running/report.py index ba7d523fbb..e227a7a18b 100644 --- a/scripts/compiler_differential/_helpers/running/report.py +++ b/scripts/compiler_differential/_helpers/running/report.py @@ -4,7 +4,9 @@ from scripts.compiler_differential.constants import ( ANALYSIS_INDIRECT_KINDS, + BASELINES_HINT, CONFIG_ONLY_KINDS, + GOLDEN_LABEL, RENDER_CONFIG_ONLY_KINDS, RENDER_INDIRECT_KINDS, ) @@ -31,15 +33,16 @@ def format_summary( engines: tuple[str, str], seconds: float, missing_coverage: dict[str, tuple[str, ...]] | None = None, + gate_failures: tuple[str, ...] = (), ) -> str: - """Summarize the run; any difference or missing coverage, keyed by stage, reports FAILED.""" + """Summarize the run; a difference, missing coverage or gate failure reports FAILED.""" differing: list[ProjectComparison] = [item for item in comparisons if item.differences] gaps: dict[str, tuple[str, ...]] = { stage: kinds for stage, kinds in (missing_coverage or {}).items() if kinds } left_engine, right_engine = engines - if not differing and not gaps: + if not differing and not gaps and not gate_failures: return ( f"Compiler differential passed: {len(comparisons)} projects identical " f"({left_engine} vs {right_engine}) in {seconds:.1f}s" @@ -54,9 +57,17 @@ def format_summary( lines.extend( f"Required {stage} coverage missing: {', '.join(kinds)}" for stage, kinds in gaps.items() ) + if gate_failures: + lines.append(f"Native fallback allow-list: {len(gate_failures)} problems (listed above)") + if gate_failures or any(_golden_differs(comparison) for comparison in differing): + lines.append(BASELINES_HINT) return "\n".join(lines) +def _golden_differs(comparison: ProjectComparison) -> bool: + return any(GOLDEN_LABEL in (difference.labels or ()) for difference in comparison.differences) + + def format_discovery_coverage(*, covered: frozenset[str], required: tuple[str, ...]) -> str: """Report how many required discovery input kinds the seed corpus exercised.""" diff --git a/scripts/compiler_differential/_helpers/running/run.py b/scripts/compiler_differential/_helpers/running/run.py index d6dbbb668f..f5ad742798 100644 --- a/scripts/compiler_differential/_helpers/running/run.py +++ b/scripts/compiler_differential/_helpers/running/run.py @@ -14,7 +14,9 @@ from scripts.compiler_differential.models import ( CorpusProject, DifferentialOptions, + FallbackGateRequest, ProjectComparison, + RecordedRun, ) @@ -31,7 +33,28 @@ def differential_options(*, args: argparse.Namespace, work_dir: Path) -> Differe require_discovery_coverage=args.require_discovery_coverage, require_render_coverage=args.require_render_coverage, require_analysis_coverage=args.require_analysis_coverage, - analysis_records=args.wheel_site_report is not None, + analysis_records=args.wheel_site_report is not None or args.native_fallbacks is not None, + golden_mode=args.goldens, + golden_dir=args.golden_dir, + ) + + +def fallback_gate_request( + *, args: argparse.Namespace, engines: tuple[str, str] +) -> FallbackGateRequest | None: + """Return the run's fallback allow-list gate, or None when it is off.""" + + if args.native_fallbacks is None: + return None + return FallbackGateRequest( + mode=args.native_fallbacks, + allow_list=args.native_fallback_list, + run=RecordedRun( + engines=engines, + corpora=tuple(args.corpus), + seed_start=args.seed_start, + seeds=args.seeds, + ), ) diff --git a/scripts/compiler_differential/constants.py b/scripts/compiler_differential/constants.py index 008e546c06..1ee5525a4d 100644 --- a/scripts/compiler_differential/constants.py +++ b/scripts/compiler_differential/constants.py @@ -10,7 +10,58 @@ ANALYSIS_RECORD_ENV_VAR: str = "SQLBUILD_ANALYSIS_RECORD_DIR" WHEEL_SITE_RECORD_PREFIX: str = "polyglot-sites-" ANALYSIS_DEFERRAL_RECORD_PREFIX: str = "analysis-deferrals-" +NATIVE_FALLBACK_RECORD_PREFIX: str = "native-fallbacks-" +NATIVE_FALLBACK_LIST: str = "scripts/compiler_differential/native_fallbacks.toml" +NATIVE_FALLBACK_MODE_UPDATE: str = "update" +NATIVE_FALLBACK_MODES: tuple[str, ...] = ("check", NATIVE_FALLBACK_MODE_UPDATE) +NATIVE_FALLBACK_SITE_SEPARATOR: str = "." +NATIVE_FALLBACK_ANSWER_SUFFIX: str = ".native" +BASELINES_HINT: str = ( + "Intended? Run `make compiler-baselines` and commit the changes to " + "scripts/compiler_differential/native_fallbacks.toml and tests/goldens/compiler, with a " + "reason in the PR body for every added entry, higher fallback count or changed golden." +) +NATIVE_FALLBACK_MAX_COUNTS_FIELD: str = "max_counts" +NATIVE_FALLBACK_COUNTS_FIELD: str = "counts" +NATIVE_FALLBACK_PROJECT_CORPUS: str = "project" +NATIVE_FALLBACK_DEFERRAL_STAGES: dict[str, str] = { + "analysis_session": "model_analysis", + "fast_columns.py": "lineage_facts", + "type_recovery.py": "semantic_checks", + "recovery.py": "semantic_checks", + "metadata_validation.py": "semantic_checks", + "contracts/columns.py": "contracts", + "contracts/promotion.py": "contracts", +} +NATIVE_FALLBACK_DEFERRAL_UNKNOWN_STAGE: str = "analysis" +NATIVE_FALLBACK_LIST_HEADER: str = ( + "# Every native-to-Python fallback and preview analysis deferral the CI corpus may still\n" + "# reach, with its exact count per corpus. `--native-fallbacks check` fails on anything new,\n" + "# changed or gone. Ports delete their entries; see scripts/compiler_differential/README.md.\n" + "# The corpus does not reach type normalization (type_system): its callers are the planner,\n" + "# the executor and the preview fallbacks, so test_native_type_parity.py covers that stage." +) RECORDS_DIRECTORY: str = "records" +GOLDEN_DIRECTORY: str = "tests/goldens/compiler" +GOLDEN_MODE_CHECK: str = "check" +GOLDEN_MODE_UPDATE: str = "update" +GOLDEN_MODES: tuple[str, ...] = (GOLDEN_MODE_CHECK, GOLDEN_MODE_UPDATE) +GOLDEN_CORPUS_PREFIXES: frozenset[str] = frozenset( + {"fixture", "example", "seed", "failure", "project"} +) +GOLDEN_SEED_CORPUS: str = "seed" +GOLDEN_SEED_RANGE_FILE: str = "seed_range.toml" +GOLDEN_SUFFIX: str = ".json" +GOLDEN_LABEL: str = "golden" +GOLDEN_MANIFEST_DROPPED_KEYS: frozenset[str] = frozenset({"metadata", "child_map"}) +GOLDEN_MANIFEST_RESOURCE_SECTIONS: tuple[str, ...] = ("nodes", "sources", "macros") +GOLDEN_RESOURCE_DROPPED_FIELDS: frozenset[str] = frozenset( + {"raw_code", "compiled_code", "checksum", "created_at"} +) +GOLDEN_PATH_MASK: str = "" +GOLDEN_WORK_MASK: str = "" +GOLDEN_VERSION_MASK: str = "" +GOLDEN_MISSING_HINT: str = "no golden; record it with `make compiler-baselines`" ENGINE_NAMES: tuple[str, ...] = ("python", "native", "native-preview") DEFAULT_ENGINES: tuple[str, str] = ("python", "native-preview") SQB_ENTRY: str = "import sys; from sqlbuild.cli.entry.main.entry import main; sys.exit(main())" diff --git a/scripts/compiler_differential/main/differential.py b/scripts/compiler_differential/main/differential.py index 446b25b09e..1c22c74df0 100644 --- a/scripts/compiler_differential/main/differential.py +++ b/scripts/compiler_differential/main/differential.py @@ -3,7 +3,6 @@ from __future__ import annotations import argparse -import json import os import sys import tempfile @@ -13,11 +12,10 @@ from scripts.compiler_differential._helpers.coverage.analysis import required_analysis_kinds from scripts.compiler_differential._helpers.coverage.discovery import required_discovery_kinds from scripts.compiler_differential._helpers.coverage.render import required_render_kinds +from scripts.compiler_differential._helpers.goldens.goldens import write_golden_seed_range +from scripts.compiler_differential._helpers.running.native_fallbacks import native_fallback_gate from scripts.compiler_differential._helpers.running.options import parse_expected_outcome -from scripts.compiler_differential._helpers.running.records import ( - format_wheel_site_report, - wheel_site_report, -) +from scripts.compiler_differential._helpers.running.records import write_wheel_site_report from scripts.compiler_differential._helpers.running.report import ( format_analysis_coverage, format_discovery_coverage, @@ -27,6 +25,7 @@ from scripts.compiler_differential._helpers.running.run import ( compare_corpus, differential_options, + fallback_gate_request, selected_corpus, ) from scripts.compiler_differential.constants import ( @@ -37,6 +36,11 @@ DEFAULT_SEED_COUNT, ENGINE_NAMES, EXPECT_SUCCESS, + GOLDEN_DIRECTORY, + GOLDEN_MODE_UPDATE, + GOLDEN_MODES, + NATIVE_FALLBACK_LIST, + NATIVE_FALLBACK_MODES, PER_PULL_REQUEST_CORPORA, ) from scripts.compiler_differential.models import DifferentialOptions, ProjectComparison @@ -60,25 +64,30 @@ def run_compiler_differential(argv: list[str] | None = None) -> int: else {} ) if args.wheel_site_report is not None: - report: dict[str, object] = wheel_site_report( - comparisons=comparisons, engines=options.engines + write_wheel_site_report( + path=args.wheel_site_report, comparisons=comparisons, engines=options.engines ) - args.wheel_site_report.parent.mkdir(parents=True, exist_ok=True) - _ = args.wheel_site_report.write_text( - json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8" + if args.goldens == GOLDEN_MODE_UPDATE and CORPUS_SEEDS in args.corpus: + write_golden_seed_range( + golden_dir=args.golden_dir, seed_start=args.seed_start, seeds=args.seeds ) - print(format_wheel_site_report(report)) + fallback_failures: tuple[str, ...] = native_fallback_gate( + request=fallback_gate_request(args=args, engines=options.engines), + comparisons=comparisons, + ) print( format_summary( comparisons=comparisons, engines=options.engines, seconds=time.monotonic() - started, missing_coverage=missing_coverage, + gate_failures=fallback_failures, ) ) return ( 1 if any(missing_coverage.values()) + or fallback_failures or any(comparison.differences for comparison in comparisons) else 0 ) @@ -179,6 +188,37 @@ def _parse_args(argv: list[str] | None) -> argparse.Namespace: "process, print them and write them to PATH as JSON (reported, never gated)" ), ) + parser.add_argument( + "--native-fallbacks", + choices=NATIVE_FALLBACK_MODES, + default=None, + help=( + "record native-to-Python fallbacks and analysis deferrals in every engine process and " + "check them against the allow-list (new, changed or vanished entries fail), or " + "rewrite the list from this run" + ), + ) + parser.add_argument( + "--native-fallback-list", + type=Path, + default=None, + help=f"fallback allow-list file (default: {NATIVE_FALLBACK_LIST} in the repository)", + ) + parser.add_argument( + "--goldens", + choices=GOLDEN_MODES, + default=None, + help=( + "check every engine's fixture, example, seed and failure outputs against the golden " + "files, or rewrite them from the first (oracle) engine" + ), + ) + parser.add_argument( + "--golden-dir", + type=Path, + default=None, + help=f"golden output directory (default: {GOLDEN_DIRECTORY} in the repository)", + ) parser.add_argument( "--engine-env", action="append", @@ -189,6 +229,11 @@ def _parse_args(argv: list[str] | None) -> argparse.Namespace: parser.add_argument("--work-dir", type=Path, default=None, help="keep run directories here") parser.add_argument("--python", type=Path, default=Path(sys.executable)) args: argparse.Namespace = parser.parse_args(argv) + repo_root: Path = Path(__file__).resolve().parents[3] + if args.golden_dir is None: + args.golden_dir = repo_root / GOLDEN_DIRECTORY + if args.native_fallback_list is None: + args.native_fallback_list = repo_root / NATIVE_FALLBACK_LIST for flag, required in ( ("--require-discovery-coverage", args.require_discovery_coverage), ("--require-render-coverage", args.require_render_coverage), diff --git a/scripts/compiler_differential/models.py b/scripts/compiler_differential/models.py index 0a9cd20d14..81539246d7 100644 --- a/scripts/compiler_differential/models.py +++ b/scripts/compiler_differential/models.py @@ -6,6 +6,8 @@ from dataclasses import dataclass, field from pathlib import Path +from scripts.compiler_differential.types import FallbackKey + @dataclass(frozen=True) class DifferentialCommand: @@ -51,10 +53,11 @@ class CommandOutcome: @dataclass(frozen=True) class AnalysisRecords: - """Wheel calls by `(site, api)` and analysis deferrals by `(kind, site)` for one run.""" + """Wheel calls by `(site, api)`, deferrals by `(kind, site)`, fallbacks by `(site, kind)`.""" wheel_sites: dict[tuple[str, str], int] = field(default_factory=dict) deferrals: dict[tuple[str, str], int] = field(default_factory=dict) + fallbacks: dict[tuple[str, str], int] = field(default_factory=dict) @dataclass(frozen=True) @@ -118,6 +121,8 @@ class DifferentialOptions: require_render_coverage: bool = False require_analysis_coverage: bool = False analysis_records: bool = False + golden_mode: str | None = None + golden_dir: Path | None = None @dataclass(frozen=True) @@ -205,3 +210,32 @@ def first_error(self) -> str | None: """Return the first reported error code, if any.""" return self.errors[0] if self.errors else None + + +@dataclass(frozen=True) +class RecordedRun: + """The engines, corpora and seed range one harness run covered.""" + + engines: tuple[str, ...] + corpora: tuple[str, ...] + seed_start: int + seeds: int + + +@dataclass(frozen=True) +class AllowList: + """Allowed counts by `(engine, stage, site, kind)` and corpus, and the seeds they hold for.""" + + seed_start: int + seeds: int + counts: dict[FallbackKey, dict[str, int]] + max_counts: dict[FallbackKey, dict[str, int]] + + +@dataclass(frozen=True) +class FallbackGateRequest: + """One run's fallback gate: check or rewrite `allow_list` from what the engines recorded.""" + + mode: str + allow_list: Path + run: RecordedRun diff --git a/scripts/compiler_differential/native_fallbacks.toml b/scripts/compiler_differential/native_fallbacks.toml new file mode 100644 index 0000000000..db49cefc10 --- /dev/null +++ b/scripts/compiler_differential/native_fallbacks.toml @@ -0,0 +1,651 @@ +# Every native-to-Python fallback and preview analysis deferral the CI corpus may still +# reach, with its exact count per corpus. `--native-fallbacks check` fails on anything new, +# changed or gone. Ports delete their entries; see scripts/compiler_differential/README.md. +# The corpus does not reach type normalization (type_system): its callers are the planner, +# the executor and the preview fallbacks, so test_native_type_parity.py covers that stage. +seed_start = 0 +seeds = 12 + +[[entry]] +engine = "native" +stage = "attachments" +site = "attachments.audit_rendering" +kind = "deferred" +counts = { seed = 16 } + +[[entry]] +engine = "native" +stage = "attachments" +site = "attachments.native" +kind = "audit_renderings" +counts = { example = 120, failure = 10, fixture = 112, seed = 354 } + +[[entry]] +engine = "native" +stage = "attachments" +site = "attachments.native" +kind = "cursor_intrinsic_rejections" +counts = { example = 160, failure = 172, fixture = 156, seed = 961 } + +[[entry]] +engine = "native" +stage = "attachments" +site = "attachments.native" +kind = "function_headers" +counts = { example = 8, failure = 7, fixture = 12, seed = 102 } + +[[entry]] +engine = "native" +stage = "attachments" +site = "attachments.native" +kind = "omitted_select_scans" +counts = { example = 24, failure = 21, fixture = 32, seed = 193 } + +[[entry]] +engine = "native" +stage = "attachments" +site = "attachments.native" +kind = "scenario_ctes" +counts = { example = 8, failure = 1, fixture = 12, seed = 37 } + +[[entry]] +engine = "native" +stage = "attachments" +site = "attachments.native" +kind = "seed_pairs" +counts = { example = 8, fixture = 4, seed = 26 } + +[[entry]] +engine = "native" +stage = "attachments" +site = "attachments.scenario_independence" +kind = "deferred" +counts = { failure = 1 } + +[[entry]] +engine = "native" +stage = "declaration_files" +site = "declaration_files.native" +kind = "failed_files" +counts = { failure = 9 } + +[[entry]] +engine = "native" +stage = "declaration_files" +site = "declaration_files.native" +kind = "parsed_files" +counts = { example = 32, failure = 69, fixture = 20, seed = 799 } + +[[entry]] +engine = "native" +stage = "declaration_files" +site = "declaration_files.native" +kind = "seed_files" +counts = { example = 8, failure = 3, fixture = 4, seed = 43 } + +[[entry]] +engine = "native" +stage = "declaration_scopes" +site = "declaration_scopes.native" +kind = "scope_indexes" +counts = { example = 12, failure = 225, fixture = 12, seed = 44 } + +[[entry]] +engine = "native" +stage = "declaration_scopes" +site = "declaration_scopes.rebind_lookup" +kind = "deferred" +counts = { failure = 1, seed = 781 } + +[[entry]] +engine = "native" +stage = "declaration_scopes" +site = "declaration_scopes.relationship_ctes" +kind = "expected_names" +counts = { example = 1, failure = 3, fixture = 3, seed = 26 } + +[[entry]] +engine = "native" +stage = "discovery" +site = "discovery.native" +kind = "model_file_listings" +counts = { example = 12, failure = 290, fixture = 12, seed = 50 } + +[[entry]] +engine = "native" +stage = "macro_call_store" +site = "macro_call_store.native" +kind = "served_calls" +counts = { example = 18, fixture = 15, seed = 192 } + +[[entry]] +engine = "native" +stage = "macro_calls" +site = "macro_calls.arguments" +kind = "deferred" +counts = { example = 6, failure = 14, fixture = 5, seed = 484 } + +[[entry]] +engine = "native" +stage = "macro_calls" +site = "macro_calls.native" +kind = "bridged_calls" +counts = { example = 32, failure = 9, fixture = 28, seed = 466 } + +[[entry]] +engine = "native" +stage = "macro_calls" +site = "macro_calls.resolution" +kind = "deferred" +counts = { failure = 4, seed = 3 } + +[[entry]] +engine = "native" +stage = "macro_calls" +site = "macro_calls.unbridged_expansion" +kind = "macro_mocks" +counts = { seed = 238 } + +[[entry]] +engine = "native" +stage = "model_config" +site = "model_config.header_metadata" +kind = "stale" +counts = { seed = 19 } + +[[entry]] +engine = "native" +stage = "model_config" +site = "model_config.header_metadata" +kind = "unsupported" +counts = { failure = 1 } + +[[entry]] +engine = "native" +stage = "model_config" +site = "model_config.native" +kind = "config_builds" +counts = { example = 56, failure = 304, fixture = 64, seed = 890 } + +[[entry]] +engine = "native" +stage = "model_config" +site = "model_config.native" +kind = "validations" +counts = { example = 56, failure = 374, fixture = 60, seed = 1091 } + +[[entry]] +engine = "native" +stage = "model_config" +site = "model_config.python_templates" +kind = "api" +counts = { example = 16, failure = 2, seed = 36 } + +[[entry]] +engine = "native" +stage = "model_config" +site = "model_config.python_templates" +kind = "config" +counts = { example = 12, failure = 115, fixture = 8, seed = 36 } + +[[entry]] +engine = "native" +stage = "model_config" +site = "model_config.python_templates" +kind = "connection" +counts = { example = 18, failure = 117, fixture = 9, seed = 63 } + +[[entry]] +engine = "native" +stage = "model_config" +site = "model_config.python_templates" +kind = "effective_vars" +counts = { example = 29, failure = 240, fixture = 15, seed = 121 } + +[[entry]] +engine = "native" +stage = "model_config" +site = "model_config.python_templates" +kind = "seed_target" +counts = { example = 8, seed = 30 } + +[[entry]] +engine = "native" +stage = "model_config" +site = "model_config.python_templates" +kind = "source_target" +counts = { example = 8, seed = 23 } + +[[entry]] +engine = "native" +stage = "model_config" +site = "model_config.validators" +kind = "deferred" +counts = { failure = 2, fixture = 4, seed = 3 } + +[[entry]] +engine = "native" +stage = "model_loop" +site = "model_loop.cursor_intrinsic_validation" +kind = "deferred" +counts = { example = 56, failure = 404, fixture = 64, seed = 1100 } + +[[entry]] +engine = "native" +stage = "model_loop" +site = "model_loop.declaration_context" +kind = "no_resource" +counts = { example = 24, failure = 9, fixture = 20, seed = 245 } + +[[entry]] +engine = "native" +stage = "model_loop" +site = "model_loop.declaration_references" +kind = "after_variables" +counts = { seed = 3 } + +[[entry]] +engine = "native" +stage = "model_loop" +site = "model_loop.native" +kind = "declaration_expansions" +counts = { example = 56, failure = 415, fixture = 64, seed = 1100 } + +[[entry]] +engine = "native" +stage = "model_loop" +site = "model_loop.native" +kind = "variable_substitutions" +counts = { example = 56, failure = 457, fixture = 72, seed = 1157 } + +[[entry]] +engine = "native" +stage = "model_loop" +site = "model_loop.sql_variables" +kind = "deferred" +counts = { failure = 3, seed = 195 } + +[[entry]] +engine = "native" +stage = "model_loop" +site = "model_loop.sql_variables" +kind = "error" +counts = { failure = 2 } + +[[entry]] +engine = "native" +stage = "reference_extraction" +site = "reference_extraction.native" +kind = "reference_scans" +counts = { example = 250, failure = 466, fixture = 249, seed = 1523 } + +[[entry]] +engine = "native-preview" +stage = "analysis" +site = "project_assembly" +kind = "syntax_error" +counts = { failure = 3 } + +[[entry]] +engine = "native-preview" +stage = "analysis" +site = "project_assembly" +kind = "unsupported_dialect" +counts = { failure = 1 } + +[[entry]] +engine = "native-preview" +stage = "attachments" +site = "attachments.audit_rendering" +kind = "deferred" +counts = { seed = 16 } + +[[entry]] +engine = "native-preview" +stage = "attachments" +site = "attachments.native" +kind = "audit_renderings" +counts = { example = 120, failure = 10, fixture = 112, seed = 354 } + +[[entry]] +engine = "native-preview" +stage = "attachments" +site = "attachments.native" +kind = "cursor_intrinsic_rejections" +counts = { example = 160, failure = 172, fixture = 156, seed = 961 } + +[[entry]] +engine = "native-preview" +stage = "attachments" +site = "attachments.native" +kind = "function_headers" +counts = { example = 8, failure = 7, fixture = 12, seed = 102 } + +[[entry]] +engine = "native-preview" +stage = "attachments" +site = "attachments.native" +kind = "omitted_select_scans" +counts = { example = 24, failure = 21, fixture = 32, seed = 193 } + +[[entry]] +engine = "native-preview" +stage = "attachments" +site = "attachments.native" +kind = "scenario_ctes" +counts = { example = 8, failure = 1, fixture = 12, seed = 37 } + +[[entry]] +engine = "native-preview" +stage = "attachments" +site = "attachments.native" +kind = "seed_pairs" +counts = { example = 8, fixture = 4, seed = 26 } + +[[entry]] +engine = "native-preview" +stage = "attachments" +site = "attachments.scenario_independence" +kind = "deferred" +counts = { failure = 1 } + +[[entry]] +engine = "native-preview" +stage = "contracts" +site = "contracts.native" +kind = "contract_validations" +counts = { example = 9, failure = 109, fixture = 6, seed = 25 } + +[[entry]] +engine = "native-preview" +stage = "contracts" +site = "contracts.native" +kind = "promotion_checks" +counts = { example = 12, failure = 109, fixture = 8, seed = 33 } + +[[entry]] +engine = "native-preview" +stage = "declaration_files" +site = "declaration_files.native" +kind = "failed_files" +counts = { failure = 9 } + +[[entry]] +engine = "native-preview" +stage = "declaration_files" +site = "declaration_files.native" +kind = "parsed_files" +counts = { example = 32, failure = 69, fixture = 20, seed = 799 } + +[[entry]] +engine = "native-preview" +stage = "declaration_files" +site = "declaration_files.native" +kind = "seed_files" +counts = { example = 8, failure = 3, fixture = 4, seed = 43 } + +[[entry]] +engine = "native-preview" +stage = "declaration_scopes" +site = "declaration_scopes.native" +kind = "scope_indexes" +counts = { example = 12, failure = 225, fixture = 12, seed = 44 } + +[[entry]] +engine = "native-preview" +stage = "declaration_scopes" +site = "declaration_scopes.rebind_lookup" +kind = "deferred" +counts = { failure = 1, seed = 781 } + +[[entry]] +engine = "native-preview" +stage = "declaration_scopes" +site = "declaration_scopes.relationship_ctes" +kind = "expected_names" +counts = { example = 1, failure = 3, fixture = 3, seed = 26 } + +[[entry]] +engine = "native-preview" +stage = "discovery" +site = "discovery.native" +kind = "model_file_listings" +counts = { example = 12, failure = 290, fixture = 12, seed = 50 } + +[[entry]] +engine = "native-preview" +stage = "lineage_facts" +site = "lineage_facts.native" +kind = "lineage_graphs" +counts = { example = 9, failure = 109, fixture = 6, seed = 22 } + +[[entry]] +engine = "native-preview" +stage = "macro_call_store" +site = "macro_call_store.native" +kind = "served_calls" +counts = { example = 18, fixture = 15, seed = 192 } + +[[entry]] +engine = "native-preview" +stage = "macro_calls" +site = "macro_calls.arguments" +kind = "deferred" +counts = { example = 6, failure = 14, fixture = 5, seed = 484 } + +[[entry]] +engine = "native-preview" +stage = "macro_calls" +site = "macro_calls.native" +kind = "bridged_calls" +counts = { example = 32, failure = 9, fixture = 28, seed = 466 } + +[[entry]] +engine = "native-preview" +stage = "macro_calls" +site = "macro_calls.resolution" +kind = "deferred" +counts = { failure = 4, seed = 3 } + +[[entry]] +engine = "native-preview" +stage = "macro_calls" +site = "macro_calls.unbridged_expansion" +kind = "macro_mocks" +counts = { seed = 238 } + +[[entry]] +engine = "native-preview" +stage = "model_analysis" +site = "analysis_session" +kind = "input_enrichment" +counts = { failure = 1 } + +[[entry]] +engine = "native-preview" +stage = "model_analysis" +site = "analysis_session" +kind = "legacy_analysis" +counts = { failure = 2, seed = 10 } + +[[entry]] +engine = "native-preview" +stage = "model_analysis" +site = "model_analysis.native" +kind = "dynamic_contract_proofs" +counts = { seed = 3 } + +[[entry]] +engine = "native-preview" +stage = "model_analysis" +site = "model_analysis.native" +kind = "expression_shapes" +counts = { example = 4, failure = 115, fixture = 4, seed = 100 } + +[[entry]] +engine = "native-preview" +stage = "model_analysis" +site = "model_analysis.native" +kind = "model_analyses" +counts = { example = 56, failure = 223, fixture = 52, seed = 686 } + +[[entry]] +engine = "native-preview" +stage = "model_config" +site = "model_config.header_metadata" +kind = "stale" +counts = { seed = 19 } + +[[entry]] +engine = "native-preview" +stage = "model_config" +site = "model_config.header_metadata" +kind = "unsupported" +counts = { failure = 1 } + +[[entry]] +engine = "native-preview" +stage = "model_config" +site = "model_config.native" +kind = "config_builds" +counts = { example = 56, failure = 304, fixture = 64, seed = 890 } + +[[entry]] +engine = "native-preview" +stage = "model_config" +site = "model_config.native" +kind = "validations" +counts = { example = 56, failure = 374, fixture = 60, seed = 1091 } + +[[entry]] +engine = "native-preview" +stage = "model_config" +site = "model_config.python_templates" +kind = "api" +counts = { example = 16, failure = 2, seed = 36 } + +[[entry]] +engine = "native-preview" +stage = "model_config" +site = "model_config.python_templates" +kind = "config" +counts = { example = 12, failure = 115, fixture = 8, seed = 36 } + +[[entry]] +engine = "native-preview" +stage = "model_config" +site = "model_config.python_templates" +kind = "connection" +counts = { example = 18, failure = 117, fixture = 9, seed = 63 } + +[[entry]] +engine = "native-preview" +stage = "model_config" +site = "model_config.python_templates" +kind = "effective_vars" +counts = { example = 29, failure = 240, fixture = 15, seed = 121 } + +[[entry]] +engine = "native-preview" +stage = "model_config" +site = "model_config.validators" +kind = "deferred" +counts = { failure = 2, fixture = 4, seed = 3 } + +[[entry]] +engine = "native-preview" +stage = "model_loop" +site = "model_loop.cursor_intrinsic_validation" +kind = "deferred" +counts = { example = 56, failure = 404, fixture = 64, seed = 1100 } + +[[entry]] +engine = "native-preview" +stage = "model_loop" +site = "model_loop.declaration_context" +kind = "no_resource" +counts = { example = 24, failure = 9, fixture = 20, seed = 245 } + +[[entry]] +engine = "native-preview" +stage = "model_loop" +site = "model_loop.declaration_references" +kind = "after_variables" +counts = { seed = 3 } + +[[entry]] +engine = "native-preview" +stage = "model_loop" +site = "model_loop.native" +kind = "declaration_expansions" +counts = { example = 56, failure = 415, fixture = 64, seed = 1100 } + +[[entry]] +engine = "native-preview" +stage = "model_loop" +site = "model_loop.native" +kind = "variable_substitutions" +counts = { example = 56, failure = 457, fixture = 72, seed = 1157 } + +[[entry]] +engine = "native-preview" +stage = "model_loop" +site = "model_loop.sql_variables" +kind = "deferred" +counts = { failure = 3, seed = 195 } + +[[entry]] +engine = "native-preview" +stage = "model_loop" +site = "model_loop.sql_variables" +kind = "error" +counts = { failure = 2 } + +[[entry]] +engine = "native-preview" +stage = "project_assembly" +site = "project_assembly.assembly" +kind = "deferred" +counts = { failure = 4 } + +[[entry]] +engine = "native-preview" +stage = "project_assembly" +site = "project_assembly.native" +kind = "project_assemblies" +counts = { example = 12, failure = 111, fixture = 8, seed = 36 } + +[[entry]] +engine = "native-preview" +stage = "reference_extraction" +site = "reference_extraction.native" +kind = "reference_scans" +counts = { example = 250, failure = 466, fixture = 249, seed = 1523 } + +[[entry]] +engine = "native-preview" +stage = "semantic_checks" +site = "semantic_checks.native" +kind = "semantic_completions" +counts = { example = 12, failure = 111, fixture = 8, seed = 36 } + +[[entry]] +engine = "native-preview" +stage = "sql_test_glue" +site = "sql_test_glue.assembly" +kind = "deferred" +counts = { example = 12, failure = 111, fixture = 8, seed = 36 } + +[[entry]] +engine = "native-preview" +stage = "sql_test_glue" +site = "sql_test_glue.native" +kind = "sql_test_plans" +counts = { example = 1, failure = 4, fixture = 1, seed = 9 } + +[[entry]] +engine = "python" +stage = "discovery" +site = "discovery.native" +kind = "model_file_listings" +counts = { example = 12, failure = 290, fixture = 12, seed = 50 } diff --git a/scripts/compiler_differential/types.py b/scripts/compiler_differential/types.py index 7ee809df54..8d7c289207 100644 --- a/scripts/compiler_differential/types.py +++ b/scripts/compiler_differential/types.py @@ -3,3 +3,5 @@ from collections.abc import Callable type NodeResolvers = tuple[Callable[[object], object], Callable[[object], object]] + +type FallbackKey = tuple[str, str, str, str] diff --git a/src/sqlbuild/adapter/type_system/_helpers/type_normalization.py b/src/sqlbuild/adapter/type_system/_helpers/type_normalization.py index b169051872..98c8f6844c 100644 --- a/src/sqlbuild/adapter/type_system/_helpers/type_normalization.py +++ b/src/sqlbuild/adapter/type_system/_helpers/type_normalization.py @@ -43,7 +43,9 @@ UNBOUNDED_TEXT_TYPE_NAMES, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.sql_analysis.main.import_polyglot import import_polyglot from sqlbuild.diagnostics.main.log_debug_event import log_debug_event @@ -59,7 +61,9 @@ def normalize_type(*, type_sql: str, dialect: TypeDialect | str | None) -> Norma type_sql=type_sql, dialect=dialect ) if native_normalized is not None: + report_native_answer(stage=NativeStage.TYPE_SYSTEM, kind="type_normalizations") return native_normalized + report_native_fallback(site=NativeFallbackSite.TYPE_NORMALIZATION) polyglot_normalized: NormalizedType | None = _normalize_with_polyglot( type_sql=type_sql, dialect=dialect, diff --git a/src/sqlbuild/cli/commands/_helpers/compile/target_writer.py b/src/sqlbuild/cli/commands/_helpers/compile/target_writer.py index 6f04c17d01..7c37371978 100644 --- a/src/sqlbuild/cli/commands/_helpers/compile/target_writer.py +++ b/src/sqlbuild/cli/commands/_helpers/compile/target_writer.py @@ -48,6 +48,7 @@ FunctionLanguage, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer from sqlbuild.compiler.frontier.types import NativeStage from sqlbuild.compiler.planner.exceptions import PlannerInputError from sqlbuild.compiler.planner.main.execution.sql_test_artifacts import ( @@ -574,9 +575,10 @@ def _plan_static_test_artifacts( with OperationLifecycle( operation_kind="project", operation_name="sql_test_planning" ) as lifecycle: + native_planning: bool = native_stage_enabled(NativeStage.SQL_TEST_GLUE) plan_artifacts: Callable[..., tuple[NativeSqlTestArtifact, ...]] = ( plan_native_sql_test_artifacts - if native_stage_enabled(NativeStage.SQL_TEST_GLUE) + if native_planning else plan_and_render_sql_test_artifacts ) native_artifacts: tuple[NativeSqlTestArtifact, ...] = plan_artifacts( @@ -585,6 +587,8 @@ def _plan_static_test_artifacts( adapter=adapter, sql_analysis_enabled=project.settings.sql_analysis, ) + if native_planning: + report_native_answer(stage=NativeStage.SQL_TEST_GLUE, kind="sql_test_plans") lifecycle.completed(metadata={"item_count": len(native_artifacts)}) return native_artifacts diff --git a/src/sqlbuild/compiler/compile/_helpers/assembly/project.py b/src/sqlbuild/compiler/compile/_helpers/assembly/project.py index 87bf84e5ab..a11284bf4e 100644 --- a/src/sqlbuild/compiler/compile/_helpers/assembly/project.py +++ b/src/sqlbuild/compiler/compile/_helpers/assembly/project.py @@ -163,6 +163,9 @@ DiagnosticSeverity, SqlTestMode, ) +from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.lineage.types import ColumnLineageMode, InferredNullability from sqlbuild.compiler.planner.types import ContractPolicy from sqlbuild.compiler.profiling.main.record import record_compile_timing @@ -1570,6 +1573,8 @@ def _build_source_relation_entry( def _expand_target_value(*, value: str | None, effective_vars: dict[str, object]) -> str | None: if value is None: return None + if native_stage_enabled(NativeStage.MODEL_CONFIG): + report_native_fallback(site=NativeFallbackSite.PYTHON_TEMPLATES, kind="source_target") return str( expand_template_data( value=value, diff --git a/src/sqlbuild/compiler/compile/_helpers/assembly/targets.py b/src/sqlbuild/compiler/compile/_helpers/assembly/targets.py index 28bd9e7bed..0f535172a1 100644 --- a/src/sqlbuild/compiler/compile/_helpers/assembly/targets.py +++ b/src/sqlbuild/compiler/compile/_helpers/assembly/targets.py @@ -8,6 +8,9 @@ from sqlbuild.compiler.compile._helpers.render.templating import expand_template_data from sqlbuild.compiler.compile.constants import PRESERVE_TARGET_VALUE from sqlbuild.compiler.compile.models import CompiledRelationLocation, CompileModelInput +from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.spec.contracts.models import DefaultsConfig, SchemaSeedEntry, TargetConfig @@ -150,6 +153,8 @@ def _expand_seed_environment_value( ) -> str | None: if raw_value == PRESERVE_TARGET_VALUE: return None + if native_stage_enabled(NativeStage.MODEL_CONFIG): + report_native_fallback(site=NativeFallbackSite.PYTHON_TEMPLATES, kind="seed_target") return str( expand_template_data( value=raw_value, @@ -174,6 +179,8 @@ def _expand_seed_target_value( ) -> str | None: if raw_value == PRESERVE_TARGET_VALUE: return None + if native_stage_enabled(NativeStage.MODEL_CONFIG): + report_native_fallback(site=NativeFallbackSite.PYTHON_TEMPLATES, kind="seed_target") return str( expand_template_data( value=raw_value, diff --git a/src/sqlbuild/compiler/compile/_helpers/attachment/audits.py b/src/sqlbuild/compiler/compile/_helpers/attachment/audits.py index 878f094901..557365de07 100644 --- a/src/sqlbuild/compiler/compile/_helpers/attachment/audits.py +++ b/src/sqlbuild/compiler/compile/_helpers/attachment/audits.py @@ -73,7 +73,9 @@ DiscoveredProjectInputs, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.references.types import SqlReferenceKind from sqlbuild.compiler.scopes.models import ( DeclarationIdentity, @@ -660,6 +662,10 @@ def build_attached_audit_input( if native_stage_enabled(NativeStage.ATTACHMENTS) else None ) + if native_rendering is None and native_stage_enabled(NativeStage.ATTACHMENTS): + report_native_fallback(site=NativeFallbackSite.AUDIT_RENDERING) + if native_rendering is not None: + report_native_answer(stage=NativeStage.ATTACHMENTS, kind="audit_renderings") if native_rendering is not None and native_rendering.render_error is not None: raise CompileInputError(native_rendering.render_error, bridge_independent=True) rendered_sql_body, rendered_evidence_sql = ( diff --git a/src/sqlbuild/compiler/compile/_helpers/attachment/core.py b/src/sqlbuild/compiler/compile/_helpers/attachment/core.py index 217d15ffd0..523b117c29 100644 --- a/src/sqlbuild/compiler/compile/_helpers/attachment/core.py +++ b/src/sqlbuild/compiler/compile/_helpers/attachment/core.py @@ -143,7 +143,9 @@ SqlHookEntry, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.model_config.main._parse_native_header_metadata import ( parse_native_header_metadata, ) @@ -554,6 +556,9 @@ def _build_model_inputs( if native_stage_enabled(NativeStage.MODEL_LOOP) else () ) + report_native_answer( + stage=NativeStage.MODEL_LOOP, kind="variable_substitutions", units=len(prepared_files) + ) loop: _ModelInputLoop = _ModelInputLoop( discovered_inputs=discovered_inputs, context=context, @@ -745,7 +750,14 @@ def _build_model_input( if prepared_var_substituted_sql is not None else None ) + if declaration_expansion is not None and native_stage_enabled(NativeStage.MODEL_LOOP): + report_native_answer(stage=NativeStage.MODEL_LOOP, kind="declaration_expansions") if declaration_expansion is None: + if native_stage_enabled(NativeStage.MODEL_LOOP): + report_native_fallback( + site=NativeFallbackSite.DECLARATION_REFERENCES, + kind="scan" if prepared_var_substituted_sql is not None else "after_variables", + ) declaration_expansion = expand_declaration_references_result( sql=var_substituted_sql, file_path=model_file.file_path, @@ -764,6 +776,8 @@ def _build_model_input( consumer=model_identity, ) expanded_query_sql: str = macro_expansion.sql + if native_stage_enabled(NativeStage.MODEL_LOOP): + report_native_fallback(site=NativeFallbackSite.CURSOR_INTRINSIC_VALIDATION) expanded_query_sql = get_validated_model_cursor_intrinsics( sql=expanded_query_sql, config_values=effective_config.values, @@ -1227,6 +1241,7 @@ def _native_seed_inputs( "has no matching CSV file under seeds/", bridge_independent=True, ) + report_native_answer(stage=NativeStage.ATTACHMENTS, kind="seed_pairs", units=len(pairs)) return tuple( CompileSeedInput( seed_file=seed_files[file_index], @@ -1263,6 +1278,8 @@ def build_effective_connection( connection.update(local_config.connections.get(connection_name, {})) connection.update(target_config.connection) connection.update(local_config.connection) + if native_stage_enabled(NativeStage.MODEL_CONFIG): + report_native_fallback(site=NativeFallbackSite.PYTHON_TEMPLATES, kind="connection") return cast( dict[str, object], expand_template_data( @@ -1305,6 +1322,8 @@ def build_effective_vars( values.update(target_config.vars) values.update(local_config.vars) values.update(cli_vars) + if native_stage_enabled(NativeStage.MODEL_CONFIG): + report_native_fallback(site=NativeFallbackSite.PYTHON_TEMPLATES, kind="effective_vars") return expand_effective_vars(values) diff --git a/src/sqlbuild/compiler/compile/_helpers/attachment/declaration_scope.py b/src/sqlbuild/compiler/compile/_helpers/attachment/declaration_scope.py index ec401a01c1..768429f794 100644 --- a/src/sqlbuild/compiler/compile/_helpers/attachment/declaration_scope.py +++ b/src/sqlbuild/compiler/compile/_helpers/attachment/declaration_scope.py @@ -28,7 +28,9 @@ ) from sqlbuild.compiler.discovery.models import DiscoveredProjectInputs from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.scopes.classes.native_scope_index import NativeScopeIndex from sqlbuild.compiler.scopes.exceptions import ScopeValidationError from sqlbuild.compiler.scopes.main._build_scope_index import build_scope_index @@ -121,6 +123,7 @@ def _build_native_declaration_scope( discovered_inputs=discovered_inputs, loaded_macros=loaded_macros ) if native is None: + report_native_fallback(site=NativeFallbackSite.SCOPE_INDEX) return None try: validate_scope_index(index=native.index) @@ -139,11 +142,14 @@ def _build_native_declaration_scope( if fault is not None: raise CompileInputError(fault, bridge_independent=True) if not native.grant(facts): + report_native_fallback(site=NativeFallbackSite.SCOPE_GRANTS) return None index: ScopeIndex = native.index_with_relationships() lookup: ScopeLookup | None = native.lookup(index=index) if lookup is None: + report_native_fallback(site=NativeFallbackSite.SCOPE_LOOKUP) return None + report_native_answer(stage=NativeStage.DECLARATION_SCOPES, kind="scope_indexes") return DeclarationScopeBuild( loaded_macros=loaded_macros, index=index, diff --git a/src/sqlbuild/compiler/compile/_helpers/attachment/functions.py b/src/sqlbuild/compiler/compile/_helpers/attachment/functions.py index f748035c3f..f88834410f 100644 --- a/src/sqlbuild/compiler/compile/_helpers/attachment/functions.py +++ b/src/sqlbuild/compiler/compile/_helpers/attachment/functions.py @@ -73,7 +73,9 @@ DiscoveredSqlFunctionFile, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.scopes.models import ResourceIdentity from sqlbuild.compiler.scopes.types import ResourceKind from sqlbuild.compiler.sql_analysis.main.import_polyglot import import_polyglot @@ -337,7 +339,10 @@ def _sql_function_header( if native else None ) + if native and native_header is None: + report_native_fallback(site=NativeFallbackSite.FUNCTION_HEADER, kind="sql") if native_header is not None: + report_native_answer(stage=NativeStage.ATTACHMENTS, kind="function_headers") _raise_header_failure(header=native_header, stage=HEADER_START_STAGE) arguments: tuple[FunctionArgument, ...] = _expanded_native_arguments( header=native_header, @@ -485,6 +490,10 @@ def _build_python_function_input( if native else None ) + if native and native_header is None: + report_native_fallback(site=NativeFallbackSite.FUNCTION_HEADER, kind="python") + if native_header is not None: + report_native_answer(stage=NativeStage.ATTACHMENTS, kind="function_headers") arguments: tuple[FunctionArgument, ...] returns: str runtime_version: str diff --git a/src/sqlbuild/compiler/compile/_helpers/attachment/model_config.py b/src/sqlbuild/compiler/compile/_helpers/attachment/model_config.py index eb2dba4c8b..db35c7d23e 100644 --- a/src/sqlbuild/compiler/compile/_helpers/attachment/model_config.py +++ b/src/sqlbuild/compiler/compile/_helpers/attachment/model_config.py @@ -65,6 +65,9 @@ PythonHookEntry, SqlHookEntry, ) +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.model_config.main._native_config_contains_macro_call import ( native_config_contains_macro_call, ) @@ -136,6 +139,7 @@ def contains_config_templates( native: bool | None = native_config_contains_template(values) if native is not None: return native + report_native_fallback(site=NativeFallbackSite.CONFIG_PRESENCE_SCAN, kind="templates") return _contains_template_data_cached( value=values, cache=scan_cache.template_presence if scan_cache is not None else None ) @@ -152,6 +156,7 @@ def contains_config_macro_calls( ) if native is not None: return native + report_native_fallback(site=NativeFallbackSite.CONFIG_PRESENCE_SCAN, kind="macros") return _contains_model_config_macro_cached( values=values, cache=scan_cache.macro_presence if scan_cache is not None else None ) @@ -372,6 +377,8 @@ def build_model_header_schema_entry( ) else None ) + if native_metadata is not None and native is None: + report_native_fallback(site=NativeFallbackSite.CONFIG_HEADER_METADATA, kind="stale") if native is not None and native.columns_error is not None: raise native_config_error(error=native.columns_error, bridge_independent=True) local_columns: tuple[SchemaColumn, ...] = ( @@ -931,7 +938,9 @@ def build_native_model_config( model_file.header_values, matched_path_default, model_file.file_path.stem ) if built is None: + report_native_fallback(site=NativeFallbackSite.CONFIG_BUILD) return None + report_native_answer(stage=NativeStage.MODEL_CONFIG, kind="config_builds") if isinstance(built, _native.NativeConfigError): raise native_config_error(error=built, bridge_independent=True) values, header_keys, namespace, overrides, reads = built @@ -1018,7 +1027,9 @@ def validate_model_config( if isinstance(outcome, _native.NativeConfigError): raise native_validation_error(error=outcome, values=request.config.values) if outcome: + report_native_answer(stage=NativeStage.MODEL_CONFIG, kind="validations") return + report_native_fallback(site=NativeFallbackSite.CONFIG_VALIDATORS) run_python_model_validators(context=context, request=request) diff --git a/src/sqlbuild/compiler/compile/_helpers/attachment/scope_relationships.py b/src/sqlbuild/compiler/compile/_helpers/attachment/scope_relationships.py index a722180754..00903c0608 100644 --- a/src/sqlbuild/compiler/compile/_helpers/attachment/scope_relationships.py +++ b/src/sqlbuild/compiler/compile/_helpers/attachment/scope_relationships.py @@ -33,6 +33,8 @@ ) from sqlbuild.compiler.compile.types import SqlTestMode from sqlbuild.compiler.discovery.models import DiscoveredProjectInputs, DiscoveredSqlTestFile +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite from sqlbuild.compiler.scopes.main._native_expected_model_names import ( native_expected_model_names, ) @@ -158,6 +160,10 @@ def extract_scope_relationship_facts( if isinstance(scanned, str): faults.append(ScopeRelationshipFault(scenario.relative_path, scanned)) continue + if scanned is None: + report_native_fallback( + site=NativeFallbackSite.SCOPE_RELATIONSHIP_CTES, kind="scenario_expected_names" + ) try: facts.append( RelationshipFact( @@ -211,6 +217,10 @@ def _expected_names_by_file( if native_names is not None: file_names.append(native_names) continue + if scan_natively: + report_native_fallback( + site=NativeFallbackSite.SCOPE_RELATIONSHIP_CTES, kind="expected_names" + ) try: file_names.append( extract_sql_test_expected_model_names( @@ -317,6 +327,7 @@ def _natively_tested_macro_names( """Macros a macro test's actual CTE calls, scanned natively where Python's scanner is exact.""" if native_ctes is None: + report_native_fallback(site=NativeFallbackSite.SCOPE_RELATIONSHIP_CTES, kind="macro_test") return _tested_macro_names(sql=sql, file_label=file_label, syntax=syntax) if isinstance(native_ctes, str): raise CompileInputError(native_ctes, bridge_independent=True) diff --git a/src/sqlbuild/compiler/compile/_helpers/diagnostics/recovery.py b/src/sqlbuild/compiler/compile/_helpers/diagnostics/recovery.py index 521430a59e..0f0d862836 100644 --- a/src/sqlbuild/compiler/compile/_helpers/diagnostics/recovery.py +++ b/src/sqlbuild/compiler/compile/_helpers/diagnostics/recovery.py @@ -28,6 +28,7 @@ CompilerDiagnostic, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer from sqlbuild.compiler.frontier.types import NativeStage from sqlbuild.compiler.semantic_checks.main._complete_native_semantic_diagnostics import ( complete_native_semantic_diagnostics, @@ -54,6 +55,7 @@ def complete_semantic_diagnostics( resource_sql_analysis=resource_sql_analysis, ) if native_project is not None: + report_native_answer(stage=NativeStage.SEMANTIC_CHECKS, kind="semantic_completions") return native_project project = recover_output_types(project=project, binding_results=binding_results) project = replace( diff --git a/src/sqlbuild/compiler/compile/_helpers/macro_bridge/expansion.py b/src/sqlbuild/compiler/compile/_helpers/macro_bridge/expansion.py index 6c46bb639c..dd2456cccd 100644 --- a/src/sqlbuild/compiler/compile/_helpers/macro_bridge/expansion.py +++ b/src/sqlbuild/compiler/compile/_helpers/macro_bridge/expansion.py @@ -21,6 +21,9 @@ MacroExpansionState, ) from sqlbuild.compiler.frontier.exceptions import NativeStageMismatchError +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.macro_bridge.classes.macro_bridge import MacroBridge from sqlbuild.compiler.macro_bridge.constants import ( ARGUMENT_REFERENCE_EVENT, @@ -60,6 +63,7 @@ def expand_bridged_sql_macros( macro_context=state.macro_context, ) if call_class is None: + report_native_fallback(site=NativeFallbackSite.MACRO_CALL_RESOLUTION) sites = None break call_classes.append(call_class) @@ -83,6 +87,7 @@ def expand_bridged_sql_macros( ) for site, call_class in zip(sites, call_classes, strict=True) ] + report_native_answer(stage=NativeStage.MACRO_CALLS, kind="bridged_calls", units=len(sites)) return bridge.splice(sql=sql, sites=sites, outputs=outputs) diff --git a/src/sqlbuild/compiler/compile/_helpers/native_stages/assembly.py b/src/sqlbuild/compiler/compile/_helpers/native_stages/assembly.py index 2c1f1bc21d..1acb384266 100644 --- a/src/sqlbuild/compiler/compile/_helpers/native_stages/assembly.py +++ b/src/sqlbuild/compiler/compile/_helpers/native_stages/assembly.py @@ -25,7 +25,9 @@ ModelSqlAnalysis, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.project_assembly.main._assemble_native_project_resources import ( assemble_native_project_resources, ) @@ -44,7 +46,7 @@ def project_resources_by_engine( if not native_stage_enabled(NativeStage.PROJECT_ASSEMBLY): return None - return assemble_native_project_resources( + resources: NativeProjectResources | None = assemble_native_project_resources( inputs=inputs, dialect=dialect, syntax_checks=model_syntax_checks( @@ -53,6 +55,11 @@ def project_resources_by_engine( analysis_succeeded=analysis_succeeded, ), ) + if resources is not None: + report_native_answer(stage=NativeStage.PROJECT_ASSEMBLY, kind="project_assemblies") + else: + report_native_fallback(site=NativeFallbackSite.PROJECT_ASSEMBLY) + return resources def expression_source_shapes_by_engine( @@ -65,6 +72,9 @@ def expression_source_shapes_by_engine( infer_native_expression_source_shapes(expressions=expressions, profile=profile) ) if native_shapes is not None: + report_native_answer( + stage=NativeStage.MODEL_ANALYSIS, kind="expression_shapes", units=len(native_shapes) + ) return native_shapes return get_expression_source_shapes(expressions=expressions, profile=profile) @@ -83,6 +93,9 @@ def analyze_model_sql_by_engine( ) ) if native_analyses is not None: + report_native_answer( + stage=NativeStage.MODEL_ANALYSIS, kind="model_analyses", units=len(native_analyses) + ) return native_analyses return python_analysis() @@ -105,5 +118,6 @@ def dynamic_column_contract_by_engine( **python_proof.keywords ) if native is not None: + report_native_answer(stage=NativeStage.MODEL_ANALYSIS, kind="dynamic_contract_proofs") return native return python_proof() diff --git a/src/sqlbuild/compiler/compile/_helpers/native_stages/sql_tests.py b/src/sqlbuild/compiler/compile/_helpers/native_stages/sql_tests.py index fde4b1cf87..e8f58c62ec 100644 --- a/src/sqlbuild/compiler/compile/_helpers/native_stages/sql_tests.py +++ b/src/sqlbuild/compiler/compile/_helpers/native_stages/sql_tests.py @@ -10,7 +10,9 @@ CompileSqlTestInput, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.sql_test_glue.main._assemble_native_sql_tests import ( assemble_native_sql_tests, ) @@ -26,5 +28,9 @@ def assemble_sql_tests_by_engine( if native_stage_enabled(NativeStage.SQL_TEST_GLUE): native_tests: tuple[CompiledSqlTest, ...] | None = assemble_native_sql_tests(inputs=inputs) if native_tests is not None: + report_native_answer( + stage=NativeStage.SQL_TEST_GLUE, kind="sql_test_assemblies", units=len(native_tests) + ) return native_tests + report_native_fallback(site=NativeFallbackSite.SQL_TEST_ASSEMBLY) return tuple(assemble_python_test(test_input) for test_input in inputs.test_inputs) diff --git a/src/sqlbuild/compiler/compile/_helpers/refs/references.py b/src/sqlbuild/compiler/compile/_helpers/refs/references.py index 5fd0299871..1d362798ee 100644 --- a/src/sqlbuild/compiler/compile/_helpers/refs/references.py +++ b/src/sqlbuild/compiler/compile/_helpers/refs/references.py @@ -34,7 +34,9 @@ SqlReferenceScanFailure, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.references.types import SqlReferenceKind from sqlbuild.compiler.sql_analysis.main._find_matching_paren import find_matching_paren from sqlbuild.compiler.sql_analysis.main._skip_dialect_non_code import dialect_non_code_end @@ -99,7 +101,11 @@ def _reference_scan_outcome( native: SqlReferenceScan | SqlReferenceScanFailure | None = extract_native_sql_references( sql=sql, syntax=syntax ) - return native if native is not None else python_reference_scan(sql=sql, syntax=syntax) + if native is not None: + report_native_answer(stage=NativeStage.REFERENCE_EXTRACTION, kind="reference_scans") + return native + report_native_fallback(site=NativeFallbackSite.REFERENCE_SCAN) + return python_reference_scan(sql=sql, syntax=syntax) if syntax.reads_differently_from_generic(sql): return python_reference_scan(sql=sql, syntax=syntax) native_references: list[tuple[str, str, str | None, int | None]] | None = ( diff --git a/src/sqlbuild/compiler/compile/_helpers/render/context_templates.py b/src/sqlbuild/compiler/compile/_helpers/render/context_templates.py index 1a544e1ad8..b995a5e940 100644 --- a/src/sqlbuild/compiler/compile/_helpers/render/context_templates.py +++ b/src/sqlbuild/compiler/compile/_helpers/render/context_templates.py @@ -15,6 +15,9 @@ PRESERVE_TARGET_VALUE, ) from sqlbuild.compiler.compile.types import CompileContextKey +from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.model_config.constants import ENVIRONMENT_READ from sqlbuild.compiler.model_config.main._expand_native_config_templates import ( expand_native_config_templates, @@ -284,6 +287,13 @@ def expand_config_templates( ): record_template_reads(outcome.reads) raise native_config_error(error=outcome.error, bridge_independent=True) + if native: + report_native_fallback( + site=NativeFallbackSite.CONFIG_TEMPLATES, + kind="unsupported" if outcome is None or isinstance(outcome, str) else "missing_value", + ) + elif native_stage_enabled(NativeStage.MODEL_CONFIG): + report_native_fallback(site=NativeFallbackSite.PYTHON_TEMPLATES, kind="config") return expand_template_data( value=value, variables=variables, diff --git a/src/sqlbuild/compiler/compile/_helpers/render/cursor_intrinsics.py b/src/sqlbuild/compiler/compile/_helpers/render/cursor_intrinsics.py index 6b18d042b6..22b464a250 100644 --- a/src/sqlbuild/compiler/compile/_helpers/render/cursor_intrinsics.py +++ b/src/sqlbuild/compiler/compile/_helpers/render/cursor_intrinsics.py @@ -12,7 +12,9 @@ ) from sqlbuild.compiler.compile.exceptions import CompileInputError from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.planner.constants import ( MICROBATCH_END_SENTINEL, MICROBATCH_START_SENTINEL, @@ -66,10 +68,13 @@ def reject_cursor_intrinsics(*, sql: str, context: str) -> None: free, error = _native.sql_free_of_cursor_intrinsics( sql, [MICROBATCH_START_SENTINEL, MICROBATCH_END_SENTINEL], context ) + if free or error is not None: + report_native_answer(stage=NativeStage.ATTACHMENTS, kind="cursor_intrinsic_rejections") if free: return if error is not None: raise CompileInputError(error) + report_native_fallback(site=NativeFallbackSite.CURSOR_INTRINSIC_REJECTION) _assert_no_reserved_cursor_markers(sql=sql, context=context) _, found = _transform_cursor_intrinsics( sql=sql, diff --git a/src/sqlbuild/compiler/compile/_helpers/render/declarations.py b/src/sqlbuild/compiler/compile/_helpers/render/declarations.py index 87043b82d7..644bb14747 100644 --- a/src/sqlbuild/compiler/compile/_helpers/render/declarations.py +++ b/src/sqlbuild/compiler/compile/_helpers/render/declarations.py @@ -33,7 +33,8 @@ ModelSchemaDeclaration, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.model_loop.constants import ( ENUM_REFERENCE_KIND_CODE, INVALID_CONSTANT_REFERENCE_STOP_CODE, @@ -167,6 +168,8 @@ def build_declaration_scope_resolver( if loaded_macros is not None: for macro in loaded_macros.values(): declarations[DeclarationIdentity(DeclarationKind.MACRO, macro.name)] = macro + if lookup is None and native_stage_enabled(NativeStage.DECLARATION_SCOPES): + report_native_fallback(site=NativeFallbackSite.SCOPE_REBIND_LOOKUP) scope_lookup: ScopeLookup = build_scope_lookup(index=scope_index) if lookup is None else lookup return DeclarationScopeResolver( project_dir=discovered_inputs.project_dir, @@ -229,6 +232,11 @@ def resolve_declaration_context( and not _scope_query_parses_identity(resource=resource, target_path=target_path) else None ) + if native_context is None and resolver.native_contexts is not None: + report_native_fallback( + site=NativeFallbackSite.DECLARATION_CONTEXT, + kind="deferred" if resources else "no_resource", + ) context: DeclarationResolutionContext = ( native_context if native_context is not None diff --git a/src/sqlbuild/compiler/compile/_helpers/render/macros.py b/src/sqlbuild/compiler/compile/_helpers/render/macros.py index f011f320a0..eb8ef33c10 100644 --- a/src/sqlbuild/compiler/compile/_helpers/render/macros.py +++ b/src/sqlbuild/compiler/compile/_helpers/render/macros.py @@ -49,6 +49,9 @@ DiscoveredMacroFile, EnumDeclaration, ) +from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.macro_bridge.classes.macro_bridge import MacroBridge from sqlbuild.compiler.macro_bridge.constants import ( DECLARATION_READ_EVENT, @@ -1209,6 +1212,11 @@ def expand_sql_macros_result( consumer=consumer, ) bridge: MacroBridge | None = active_macro_bridge() if not state.macro_overrides else None + if bridge is None and MACRO_TOKEN in sql and native_stage_enabled(NativeStage.MACRO_CALLS): + report_native_fallback( + site=NativeFallbackSite.MACRO_UNBRIDGED_EXPANSION, + kind="macro_mocks" if state.macro_overrides else "outside_compile_inputs", + ) expanded_sql, spans = ( _expand_sql_macros( sql=sql, @@ -1772,6 +1780,8 @@ def _parse_macro_arguments( ) -> tuple[tuple[object, ...], dict[str, object]]: if not args_source.strip(): return (), {} + if native_stage_enabled(NativeStage.MACRO_CALLS): + report_native_fallback(site=NativeFallbackSite.MACRO_ARGUMENTS) rewritten_args_source: str placeholder_values: dict[str, object] rewritten_args_source, placeholder_values = _rewrite_nested_macro_calls( diff --git a/src/sqlbuild/compiler/compile/_helpers/render/sql_vars.py b/src/sqlbuild/compiler/compile/_helpers/render/sql_vars.py index a25848e0df..e6e19e3b0d 100644 --- a/src/sqlbuild/compiler/compile/_helpers/render/sql_vars.py +++ b/src/sqlbuild/compiler/compile/_helpers/render/sql_vars.py @@ -38,7 +38,8 @@ ) from sqlbuild.compiler.compile.types import TypedSqlValueRenderer from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.model_loop.main._scan_native_declaration_references import ( scan_native_declaration_references, ) @@ -116,6 +117,8 @@ def expand_authored_sql_result( # noqa: PLR0913 if native else None ) + if native and scanned_result is None: + report_native_fallback(site=NativeFallbackSite.DECLARATION_REFERENCES, kind="scan") declaration_result: DeclarationExpansionResult = ( scanned_result if scanned_result is not None @@ -227,6 +230,7 @@ def prepare_static_project_vars_batch( if not isinstance(raw_results, list) or len(raw_results) != len(sqls): raise CompileInputError("native static SQL interpolation returned an invalid batch") results: list[str | None] = [] + counted: bool = native_stage_enabled(NativeStage.MODEL_LOOP) for sql, raw_result in zip(sqls, raw_results, strict=True): if not ( isinstance(raw_result, tuple) @@ -241,6 +245,8 @@ def prepare_static_project_vars_batch( elif status == _NATIVE_SUBSTITUTED and rendered is not None: results.append(rendered) elif status == _NATIVE_FALLBACK and rendered is None: + if counted: + report_native_fallback(site=NativeFallbackSite.SQL_VARIABLES) results.append(None) elif status in _NATIVE_ERROR_STATUSES: if error_file_path is not None: @@ -250,6 +256,8 @@ def prepare_static_project_vars_batch( file_path=error_file_path, effective_vars=effective_vars, ) + if counted: + report_native_fallback(site=NativeFallbackSite.SQL_VARIABLES, kind="error") results.append(None) else: raise CompileInputError("native static SQL interpolation returned an invalid status") diff --git a/src/sqlbuild/compiler/compile/_helpers/scenarios/core.py b/src/sqlbuild/compiler/compile/_helpers/scenarios/core.py index 40e81b2b60..11682b900c 100644 --- a/src/sqlbuild/compiler/compile/_helpers/scenarios/core.py +++ b/src/sqlbuild/compiler/compile/_helpers/scenarios/core.py @@ -30,7 +30,9 @@ CompileSqlScenarioCtes, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.sql_analysis.models import SqlLexicalSyntax _CONTEXT: str = "SQL scenario" @@ -50,7 +52,10 @@ def extract_sql_scenario_ctes( else None ) if native_ctes is not None: + report_native_answer(stage=NativeStage.ATTACHMENTS, kind="scenario_ctes") return native_ctes + if native_stage_enabled(NativeStage.ATTACHMENTS): + report_native_fallback(site=NativeFallbackSite.SCENARIO_CTES) ctes: tuple[CompileSqlScenarioCte, ...] = extract_top_level_ctes_with_scanner( sql=sql, file_label=file_label, @@ -91,6 +96,7 @@ def _scenario_from_native_outcome( independence: list[list[str]] | None = outcome.get("independence") if independence is not None: + report_native_fallback(site=NativeFallbackSite.SCENARIO_INDEPENDENCE) validate_independent_expected_and_assertion_ctes( ctes=_scenario_ctes(independence), expected_prefix=EXPECTED_TEST_CTE_PREFIX, diff --git a/src/sqlbuild/compiler/compile/_helpers/sql_tests/core.py b/src/sqlbuild/compiler/compile/_helpers/sql_tests/core.py index 47a41fee26..4157dd2385 100644 --- a/src/sqlbuild/compiler/compile/_helpers/sql_tests/core.py +++ b/src/sqlbuild/compiler/compile/_helpers/sql_tests/core.py @@ -30,7 +30,9 @@ omitted_ceremonial_select_offset, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled -from sqlbuild.compiler.frontier.types import NativeStage +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.references.types import SqlReferenceKind from sqlbuild.compiler.sql_analysis.main._find_matching_paren import find_matching_paren from sqlbuild.compiler.sql_analysis.main._is_identifier_character import ( @@ -157,7 +159,11 @@ def complete_omitted_ceremonial_select(*, sql: str, syntax: SqlLexicalSyntax) -> if native_stage_enabled(NativeStage.ATTACHMENTS) else (False, None) ) - if not answered: + if answered: + report_native_answer(stage=NativeStage.ATTACHMENTS, kind="omitted_select_scans") + else: + if native_stage_enabled(NativeStage.ATTACHMENTS): + report_native_fallback(site=NativeFallbackSite.OMITTED_SELECT) offset = omitted_ceremonial_select_offset(sql=sql, syntax=syntax) if offset is None: return sql diff --git a/src/sqlbuild/compiler/compile/main/expand_sql_with_spans.py b/src/sqlbuild/compiler/compile/main/expand_sql_with_spans.py index ec9f8da08e..2b1771d007 100644 --- a/src/sqlbuild/compiler/compile/main/expand_sql_with_spans.py +++ b/src/sqlbuild/compiler/compile/main/expand_sql_with_spans.py @@ -11,6 +11,9 @@ ExpansionSpan, SqlExpansionContext, ) +from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage def expand_sql_with_spans( @@ -36,6 +39,8 @@ def expand_sql_with_spans( inaccessible_enums=declarations.inaccessible_enums, inaccessible_constants=declarations.inaccessible_constants, ) + if native_stage_enabled(NativeStage.MODEL_LOOP): + report_native_fallback(site=NativeFallbackSite.LINT_EXPANSION) return expand_authored_sql_with_spans( sql=sql, file_path=file_path, diff --git a/src/sqlbuild/compiler/compile/main/expand_template_data.py b/src/sqlbuild/compiler/compile/main/expand_template_data.py index cd173d3d2f..ac93265bdf 100644 --- a/src/sqlbuild/compiler/compile/main/expand_template_data.py +++ b/src/sqlbuild/compiler/compile/main/expand_template_data.py @@ -5,6 +5,9 @@ from sqlbuild.compiler.compile._helpers.render.templating import ( expand_template_data as _expand_template_data, ) +from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage def expand_template_data( @@ -19,6 +22,8 @@ def expand_template_data( ) -> object: """Recursively expand template strings inside supported Python container values.""" + if native_stage_enabled(NativeStage.MODEL_CONFIG): + report_native_fallback(site=NativeFallbackSite.PYTHON_TEMPLATES, kind="api") return _expand_template_data( value=value, variables=variables, diff --git a/src/sqlbuild/compiler/contracts/main/promotion_conflicts.py b/src/sqlbuild/compiler/contracts/main/promotion_conflicts.py index 5e86bbab99..33edbfd775 100644 --- a/src/sqlbuild/compiler/contracts/main/promotion_conflicts.py +++ b/src/sqlbuild/compiler/contracts/main/promotion_conflicts.py @@ -9,6 +9,7 @@ native_promotion_conflict_diagnostics, ) from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer from sqlbuild.compiler.frontier.types import NativeStage @@ -25,6 +26,7 @@ def promotion_conflict_diagnostics( project=project, adapter_default=adapter_default, settings_file=settings_file ) if native is not None: + report_native_answer(stage=NativeStage.CONTRACTS, kind="promotion_checks") return native return promotion_conflict_diagnostics_impl( project=project, adapter_default=adapter_default, settings_file=settings_file diff --git a/src/sqlbuild/compiler/contracts/main/validate.py b/src/sqlbuild/compiler/contracts/main/validate.py index a3ea86bee3..a51a6dda3b 100644 --- a/src/sqlbuild/compiler/contracts/main/validate.py +++ b/src/sqlbuild/compiler/contracts/main/validate.py @@ -13,6 +13,7 @@ ) from sqlbuild.compiler.contracts.models import ContractValidationResult from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer from sqlbuild.compiler.frontier.types import NativeStage from sqlbuild.spec.contracts.types import ColumnContractMode @@ -29,6 +30,7 @@ def evaluate_model_contracts( project=project, dialect=dialect ) if native_result is not None: + report_native_answer(stage=NativeStage.CONTRACTS, kind="contract_validations") return native_result mode: ColumnContractMode = project.settings.column_contract_mode if not any(requires_contract_evaluation(model=model, mode=mode) for model in project.models): diff --git a/src/sqlbuild/compiler/discovery/_helpers/native/declaration_files.py b/src/sqlbuild/compiler/discovery/_helpers/native/declaration_files.py index 3316b96fe2..b7bdf895a6 100644 --- a/src/sqlbuild/compiler/discovery/_helpers/native/declaration_files.py +++ b/src/sqlbuild/compiler/discovery/_helpers/native/declaration_files.py @@ -49,6 +49,9 @@ ModelSchemaDeclaration, ) from sqlbuild.compiler.discovery.types import NativeFileScope, NativeLocation, NativeScopeFields +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.scopes.types import DeclarationKind, ScopeKind type _NativeDeclarationFile = tuple[str, NativeFileScope | None, tuple[object, ...]] @@ -188,10 +191,12 @@ def native_macro_files( def native_seed_files(*, project_dir: Path) -> tuple[DiscoveredSeedFile, ...]: """Discover the seed files natively.""" - return tuple( + seeds: tuple[DiscoveredSeedFile, ...] = tuple( DiscoveredSeedFile(file_path=project_dir / relative_path, relative_path=Path(relative_path)) for relative_path, _scope, _payload in _native_files(project_dir=project_dir, kind="seed") ) + report_native_answer(stage=NativeStage.DECLARATION_FILES, kind="seed_files", units=len(seeds)) + return seeds def retained_discovery_session(*, project_dir: Path) -> _native.NativeDiscoverySession | None: @@ -274,12 +279,15 @@ def _record[RecordT]( scope, payload = item tag: object = payload[0] if tag == NATIVE_DEFERRED_TAG: + report_native_fallback(site=NativeFallbackSite.DECLARATION_FILE) return parse_with_python(relative_path=relative_path, scope=scope) if tag == NATIVE_PARSED_TAG: + report_native_answer(stage=NativeStage.DECLARATION_FILES, kind="parsed_files") return build( project_dir=project_dir, relative_path=relative_path, scope=scope, payload=payload ) if tag == NATIVE_FAILED_TAG: + report_native_answer(stage=NativeStage.DECLARATION_FILES, kind="failed_files") raise native_failure(payload) raise native_read_error(payload=payload, file_path=project_dir / relative_path) diff --git a/src/sqlbuild/compiler/discovery/_helpers/native/model_files.py b/src/sqlbuild/compiler/discovery/_helpers/native/model_files.py index 4c166f2493..ee78a71c88 100644 --- a/src/sqlbuild/compiler/discovery/_helpers/native/model_files.py +++ b/src/sqlbuild/compiler/discovery/_helpers/native/model_files.py @@ -28,6 +28,8 @@ ) from sqlbuild.compiler.discovery.models import DiscoveredSqlModelFile, DiscoveryFileFault from sqlbuild.compiler.discovery.types import NativeFiles, NativeLocation +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.types import NativeStage def discover_native_model_files( @@ -58,6 +60,7 @@ def discover_native_model_files( project_dir=project_dir, ) seed_snapshot_listings(project_dir=project_dir, tree=tree) + report_native_answer(stage=NativeStage.DISCOVERY, kind="model_file_listings") return materialise_native_files( project_dir=project_dir, files=( diff --git a/src/sqlbuild/compiler/frontier/_helpers/process_recorder.py b/src/sqlbuild/compiler/frontier/_helpers/process_recorder.py new file mode 100644 index 0000000000..37f53b4700 --- /dev/null +++ b/src/sqlbuild/compiler/frontier/_helpers/process_recorder.py @@ -0,0 +1,12 @@ +"""The process's debug recorder of native fallbacks and answers, created once.""" + +from functools import cache + +from sqlbuild.compiler.frontier.classes.native_fallback_recorder import NativeFallbackRecorder + + +@cache +def process_recorder() -> NativeFallbackRecorder | None: + """Return the recorder when the debug record directory is set, otherwise None.""" + + return NativeFallbackRecorder.from_environment() diff --git a/src/sqlbuild/compiler/frontier/classes/native_fallback_recorder.py b/src/sqlbuild/compiler/frontier/classes/native_fallback_recorder.py new file mode 100644 index 0000000000..270c533694 --- /dev/null +++ b/src/sqlbuild/compiler/frontier/classes/native_fallback_recorder.py @@ -0,0 +1,50 @@ +"""Debug-only count of the native fallbacks and native answers of one process, written at exit.""" + +from __future__ import annotations + +import atexit +import json +import os +import threading +from collections import Counter +from pathlib import Path + +from sqlbuild.compiler.frontier.constants import NATIVE_FALLBACK_RECORD_PREFIX +from sqlbuild.compiler.sql_analysis.constants import ANALYSIS_RECORD_DIR_ENV_VAR + + +class NativeFallbackRecorder: + """Count fallbacks and answers by `(site, kind)` and write them once, at process exit.""" + + def __init__(self, *, directory: Path) -> None: + self._directory: Path = directory + self._counts: Counter[tuple[str, str]] = Counter() + self._lock: threading.Lock = threading.Lock() + _ = atexit.register(self.write) + + @classmethod + def from_environment(cls) -> NativeFallbackRecorder | None: + """Return a recorder when the debug record directory is set, otherwise None.""" + + directory: str | None = os.environ.get(ANALYSIS_RECORD_DIR_ENV_VAR) + return cls(directory=Path(directory)) if directory else None + + def record(self, *, site: str, kind: str, units: int = 1) -> None: + """Count `units` fallbacks or answers at `site` of the sort `kind`.""" + + with self._lock: + self._counts[(site, kind)] += units + + def write(self) -> None: + """Write the counts so far as `{"fallbacks": [[site, kind, count], ...]}`; none, no file.""" + + with self._lock: + counts: Counter[tuple[str, str]] = self._counts.copy() + if not counts: + return + self._directory.mkdir(parents=True, exist_ok=True) + rows: list[list[object]] = [ + [site, kind, count] for (site, kind), count in sorted(counts.items()) + ] + target: Path = self._directory / f"{NATIVE_FALLBACK_RECORD_PREFIX}{os.getpid()}.json" + _ = target.write_text(json.dumps({"fallbacks": rows}) + "\n", encoding="utf-8") diff --git a/src/sqlbuild/compiler/frontier/constants.py b/src/sqlbuild/compiler/frontier/constants.py index 195b5404c3..cd1adcea0d 100644 --- a/src/sqlbuild/compiler/frontier/constants.py +++ b/src/sqlbuild/compiler/frontier/constants.py @@ -41,6 +41,9 @@ TARGET_DIRECTORY_NAME: str = "target" CACHE_DIRECTORY_NAME: str = "cache" COMPILER_CACHE_DIRECTORY_NAME: str = "compiler" +NATIVE_FALLBACK_RECORD_PREFIX: str = "native-fallbacks-" +NATIVE_FALLBACK_DEFAULT_KIND: str = "deferred" +NATIVE_ANSWER_SITE_SUFFIX: str = ".native" STAGE_CAPTURE_DIR_ENV_VAR: str = "SQLBUILD_COMPILER_STAGE_CAPTURE_DIR" COMPILE_REUSE_DISABLE_ENV_VAR: str = "SQLBUILD_DISABLE_COMPILE_REUSE" STAGE_CAPTURE_SUFFIX: str = ".json" diff --git a/src/sqlbuild/compiler/frontier/main/report_native_answer.py b/src/sqlbuild/compiler/frontier/main/report_native_answer.py new file mode 100644 index 0000000000..4acc7b2f00 --- /dev/null +++ b/src/sqlbuild/compiler/frontier/main/report_native_answer.py @@ -0,0 +1,14 @@ +"""Count work a native stage answered itself, so a stage switched to Python is noticed.""" + +from sqlbuild.compiler.frontier._helpers.process_recorder import process_recorder +from sqlbuild.compiler.frontier.classes.native_fallback_recorder import NativeFallbackRecorder +from sqlbuild.compiler.frontier.constants import NATIVE_ANSWER_SITE_SUFFIX +from sqlbuild.compiler.frontier.types import NativeStage + + +def report_native_answer(*, stage: NativeStage, kind: str, units: int = 1) -> None: + """Record `units` of work of the sort `kind` that `stage` answered natively, when recording.""" + + recorder: NativeFallbackRecorder | None = process_recorder() + if recorder is not None and units: + recorder.record(site=f"{stage.value}{NATIVE_ANSWER_SITE_SUFFIX}", kind=kind, units=units) diff --git a/src/sqlbuild/compiler/frontier/main/report_native_fallback.py b/src/sqlbuild/compiler/frontier/main/report_native_fallback.py new file mode 100644 index 0000000000..8c2f0ba101 --- /dev/null +++ b/src/sqlbuild/compiler/frontier/main/report_native_fallback.py @@ -0,0 +1,16 @@ +"""Count one place where a native stage handed its work back to Python.""" + +from sqlbuild.compiler.frontier._helpers.process_recorder import process_recorder +from sqlbuild.compiler.frontier.classes.native_fallback_recorder import NativeFallbackRecorder +from sqlbuild.compiler.frontier.constants import NATIVE_FALLBACK_DEFAULT_KIND +from sqlbuild.compiler.frontier.types import NativeFallbackSite + + +def report_native_fallback( + *, site: NativeFallbackSite, kind: str = NATIVE_FALLBACK_DEFAULT_KIND +) -> None: + """Record a fallback at `site` when the debug record directory is set; otherwise do nothing.""" + + recorder: NativeFallbackRecorder | None = process_recorder() + if recorder is not None: + recorder.record(site=site.value, kind=kind) diff --git a/src/sqlbuild/compiler/frontier/types.py b/src/sqlbuild/compiler/frontier/types.py index 17b611e46f..e3e38174ff 100644 --- a/src/sqlbuild/compiler/frontier/types.py +++ b/src/sqlbuild/compiler/frontier/types.py @@ -45,3 +45,42 @@ class CompilerStage(StrEnum): DISCOVERED_PROJECT_INPUTS = "discovered_project_inputs" COMPILE_PROJECT_INPUTS = "compile_project_inputs" COMPILED_PROJECT = "compiled_project" + + +class NativeFallbackSite(StrEnum): + """A place where a shipped native stage still hands its work to the Python implementation.""" + + DECLARATION_FILE = "declaration_files.file" + SCOPE_INDEX = "declaration_scopes.index" + SCOPE_GRANTS = "declaration_scopes.grants" + SCOPE_LOOKUP = "declaration_scopes.lookup" + SCOPE_REBIND_LOOKUP = "declaration_scopes.rebind_lookup" + SCOPE_RELATIONSHIP_CTES = "declaration_scopes.relationship_ctes" + SQL_VARIABLES = "model_loop.sql_variables" + DECLARATION_REFERENCES = "model_loop.declaration_references" + DECLARATION_CONTEXT = "model_loop.declaration_context" + CURSOR_INTRINSIC_VALIDATION = "model_loop.cursor_intrinsic_validation" + LINT_EXPANSION = "model_loop.lint_expansion" + MACRO_CALL_SCAN = "macro_calls.scan" + MACRO_CALL_RESOLUTION = "macro_calls.resolution" + MACRO_CALL_SPLICE = "macro_calls.splice" + MACRO_CALL_MEMO = "macro_calls.memo" + MACRO_ARGUMENTS = "macro_calls.arguments" + MACRO_UNBRIDGED_EXPANSION = "macro_calls.unbridged_expansion" + MACRO_BRIDGE_UNAVAILABLE = "macro_calls.bridge_unavailable" + REFERENCE_SCAN = "reference_extraction.scan" + CONFIG_BUILD = "model_config.build" + CONFIG_HEADER_METADATA = "model_config.header_metadata" + CONFIG_TEMPLATES = "model_config.templates" + CONFIG_PRESENCE_SCAN = "model_config.presence_scan" + CONFIG_VALIDATORS = "model_config.validators" + PYTHON_TEMPLATES = "model_config.python_templates" + AUDIT_RENDERING = "attachments.audit_rendering" + FUNCTION_HEADER = "attachments.function_header" + CURSOR_INTRINSIC_REJECTION = "attachments.cursor_intrinsic_rejection" + SCENARIO_CTES = "attachments.scenario_ctes" + SCENARIO_INDEPENDENCE = "attachments.scenario_independence" + OMITTED_SELECT = "attachments.omitted_select" + PROJECT_ASSEMBLY = "project_assembly.assembly" + TYPE_NORMALIZATION = "type_system.normalization" + SQL_TEST_ASSEMBLY = "sql_test_glue.assembly" diff --git a/src/sqlbuild/compiler/lineage/main/columns.py b/src/sqlbuild/compiler/lineage/main/columns.py index fc44eab5bc..735a03c3d2 100644 --- a/src/sqlbuild/compiler/lineage/main/columns.py +++ b/src/sqlbuild/compiler/lineage/main/columns.py @@ -4,6 +4,7 @@ from sqlbuild.compiler.compile.models import CompiledProject from sqlbuild.compiler.frontier.main.native_stage_enabled import native_stage_enabled +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer from sqlbuild.compiler.frontier.types import NativeStage from sqlbuild.compiler.lineage._helpers.fast_columns import ( build_fast_project_column_lineage, @@ -34,6 +35,7 @@ def build_project_column_lineage( project=project, dialect=dialect, model_names=model_names ) if native_lineage is not None: + report_native_answer(stage=NativeStage.LINEAGE_FACTS, kind="lineage_graphs") return native_lineage return build_fast_project_column_lineage( project=project, diff --git a/src/sqlbuild/compiler/macro_bridge/classes/macro_bridge.py b/src/sqlbuild/compiler/macro_bridge/classes/macro_bridge.py index 731fe2ca5b..2ee2d9cf15 100644 --- a/src/sqlbuild/compiler/macro_bridge/classes/macro_bridge.py +++ b/src/sqlbuild/compiler/macro_bridge/classes/macro_bridge.py @@ -14,6 +14,8 @@ LoadedMacro, MacroContext, ) +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite from sqlbuild.compiler.macro_bridge._helpers.splicing import splice_text from sqlbuild.compiler.macro_bridge._helpers.store_environment import ( digest_module_files, @@ -139,8 +141,10 @@ def scan(self, sql: str) -> tuple[MacroCallSite, ...] | None: _native.scan_macro_call_sites(sql, self._python_version, self._unicode_version) ) except UnicodeEncodeError: + report_native_fallback(site=NativeFallbackSite.MACRO_CALL_SCAN, kind="unencodable") return None if rows is None: + report_native_fallback(site=NativeFallbackSite.MACRO_CALL_SCAN) return None return tuple( MacroCallSite( @@ -258,6 +262,7 @@ def record( ), ) except UnicodeEncodeError: + report_native_fallback(site=NativeFallbackSite.MACRO_CALL_MEMO, kind="unencodable") return def splice( @@ -271,6 +276,7 @@ def splice( try: rendered, spans = _native.splice_macro_calls(sql, bounds, outputs) except UnicodeEncodeError: + report_native_fallback(site=NativeFallbackSite.MACRO_CALL_SPLICE, kind="unencodable") rendered, spans = splice_text(sql=sql, bounds=bounds, outputs=outputs) return rendered, tuple( ExpansionSpan( diff --git a/src/sqlbuild/compiler/macro_bridge/main/run_with_macro_bridge.py b/src/sqlbuild/compiler/macro_bridge/main/run_with_macro_bridge.py index fcaa59d694..1d53c9869c 100644 --- a/src/sqlbuild/compiler/macro_bridge/main/run_with_macro_bridge.py +++ b/src/sqlbuild/compiler/macro_bridge/main/run_with_macro_bridge.py @@ -9,6 +9,9 @@ from contextvars import Token import sqlbuild._native as _native +from sqlbuild.compiler.frontier.main.report_native_answer import report_native_answer +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite, NativeStage from sqlbuild.compiler.macro_bridge.classes.macro_bridge import MacroBridge from sqlbuild.compiler.macro_bridge.constants import ACTIVE_MACRO_BRIDGE, STORE_MODULE_PATHS @@ -18,6 +21,7 @@ def run_with_macro_bridge[T](*, stage: Callable[[], T]) -> T: python_version: tuple[int, int] = (sys.version_info[0], sys.version_info[1]) if not _native.native_text_supported(python_version, unicodedata.unidata_version): + report_native_fallback(site=NativeFallbackSite.MACRO_BRIDGE_UNAVAILABLE) return stage() bridge: MacroBridge = MacroBridge( python_version=python_version, unicode_version=unicodedata.unidata_version @@ -31,6 +35,7 @@ def run_with_macro_bridge[T](*, stage: Callable[[], T]) -> T: STORE_MODULE_PATHS.update(bridge.store_module_paths()) hits, misses, recorded = bridge.stats() store_hits, store_records = bridge.store_stats() + report_native_answer(stage=NativeStage.MACRO_CALL_STORE, kind="served_calls", units=store_hits) logging.getLogger(__name__).debug( "Native macro bridge: %d memo hits, %d store hits, %d misses, %d recorded calls, " "%d stored calls", diff --git a/src/sqlbuild/compiler/model_config/main/_parse_native_header_metadata.py b/src/sqlbuild/compiler/model_config/main/_parse_native_header_metadata.py index 6314d37b52..cc35ecbd20 100644 --- a/src/sqlbuild/compiler/model_config/main/_parse_native_header_metadata.py +++ b/src/sqlbuild/compiler/model_config/main/_parse_native_header_metadata.py @@ -9,6 +9,8 @@ import sqlbuild._native as _native from sqlbuild.compiler.auditing.types import AuditSeverity from sqlbuild.compiler.discovery.models import DiscoveredSqlModelFile +from sqlbuild.compiler.frontier.main.report_native_fallback import report_native_fallback +from sqlbuild.compiler.frontier.types import NativeFallbackSite from sqlbuild.compiler.model_config.constants import ( AUDITS_HEADER_KEY, COLUMNS_HEADER_KEY, @@ -47,7 +49,13 @@ def parse_native_header_metadata( }, ) except (TypeError, ValueError): + report_native_fallback(site=NativeFallbackSite.CONFIG_HEADER_METADATA, kind="batch") return {} + for metadata in parsed: + if metadata == UNSUPPORTED_OUTCOME: + report_native_fallback( + site=NativeFallbackSite.CONFIG_HEADER_METADATA, kind="unsupported" + ) return { model_file.file_path: _native_metadata(model_file=model_file, metadata=metadata) for model_file, metadata in zip(model_files, parsed, strict=True) diff --git a/tests/e2e/scripts/compiler_differential/_test_types.py b/tests/e2e/scripts/compiler_differential/_test_types.py index e488fe198a..0369dcd081 100644 --- a/tests/e2e/scripts/compiler_differential/_test_types.py +++ b/tests/e2e/scripts/compiler_differential/_test_types.py @@ -4,6 +4,8 @@ from dataclasses import dataclass +from scripts.compiler_differential.models import FailureCase + @dataclass(frozen=True) class HarnessRunTestCase: @@ -114,3 +116,32 @@ class WheelSiteReportTestCase: expected_lines: tuple[str, ...] expected_sites: frozenset[str] expected_deferrals: frozenset[str] + + +@dataclass(frozen=True) +class NativeFallbackGateTestCase: + """A recorded allow-list, an edit or sabotage, and the verdict of the next checked run.""" + + description: str + perturbation: str + appended_entries: str + expected_exit_code: int + expected_lines: tuple[str, ...] + + +@dataclass(frozen=True) +class GoldenOutputTestCase: + """Goldens recorded for one project, an edit to them, and the check verdict.""" + + description: str + golden_edit: tuple[str, str] + expected_exit_code: int + expected_lines: tuple[str, ...] + + +@dataclass(frozen=True) +class EngineErrorCaseTestCase: + """One shared all-engine error case from the failure corpus, holding its exact error.""" + + description: str + expected_error_case: FailureCase diff --git a/tests/e2e/scripts/compiler_differential/helpers.py b/tests/e2e/scripts/compiler_differential/helpers.py index 407113d85c..0c39b1c9cc 100644 --- a/tests/e2e/scripts/compiler_differential/helpers.py +++ b/tests/e2e/scripts/compiler_differential/helpers.py @@ -99,6 +99,36 @@ def _perturbed(self, **changes): _record.write(json.dumps({"kind": "legacy_fallback", "site": "orders.sql"}) + "\\n") """ +REFERENCE_SCAN_SABOTAGE: str = """ +import sqlbuild.compiler.compile._helpers.refs.references as references + +references.extract_native_sql_references = lambda **_: None +""" + +MODEL_ANALYSIS_SABOTAGE: str = """ +import sqlbuild._native as native + +native.start_model_analysis_session = lambda *_args: None +""" + +_STAGE_DISABLE_SABOTAGE: str = """ +import sqlbuild.compiler.frontier.main.native_stage_enabled as enabled +from sqlbuild.compiler.frontier.types import NativeStage + +_original = enabled.native_stage_enabled +_disabled = {{{stages}}} +enabled.native_stage_enabled = lambda stage: stage not in _disabled and _original(stage) +""" + + +def stage_disable_sabotage(stages: tuple[str, ...]) -> str: + """A perturbation switching these native stages off, so their work runs in Python.""" + + return _STAGE_DISABLE_SABOTAGE.format( + stages=", ".join(f"NativeStage({stage!r})" for stage in stages) + ) + + _BROKEN_REF_FILES: dict[str, str] = { "sqlbuild_project.toml": ( 'name = "broken_orders"\nadapter = "duckdb"\n\n' diff --git a/tests/e2e/scripts/compiler_differential/test_engine_error_cases.py b/tests/e2e/scripts/compiler_differential/test_engine_error_cases.py new file mode 100644 index 0000000000..6cd931ccf1 --- /dev/null +++ b/tests/e2e/scripts/compiler_differential/test_engine_error_cases.py @@ -0,0 +1,61 @@ +"""Every engine reports each shared user-facing error with the same exact code, text and help. + +Ports add cases to `engine_error_cases()` in the failure corpus, not here. +""" + +from __future__ import annotations + +import sys +from pathlib import Path + +import pytest + +from scripts.compiler_differential._helpers.corpus.emitted_codes import case_emitted_codes +from scripts.compiler_differential._helpers.corpus.failure_cases import engine_error_cases +from scripts.compiler_differential.models import DifferentialOptions, EmittedCodes +from tests.e2e.scripts.compiler_differential._test_types import EngineErrorCaseTestCase + +_ENGINES: tuple[str, ...] = ("python", "native", "native-preview") + + +@pytest.mark.parametrize( + "test_case", + [ + EngineErrorCaseTestCase(description=case.name, expected_error_case=case) + for case in engine_error_cases() + ], + ids=lambda case: case.description, +) +def test_given_shared_error_case_when_compiling_on_every_engine_then_error_text_is_exact( + test_case: EngineErrorCaseTestCase, tmp_path: Path +) -> None: + emitted: dict[str, EmittedCodes] = { + engine: case_emitted_codes( + case=test_case.expected_error_case, + options=DifferentialOptions( + engines=(engine, engine), + work_dir=tmp_path / engine, + jobs=1, + stage_captures=False, + python=Path(sys.executable), + engine_environment={}, + ), + ) + for engine in _ENGINES + } + + assert { + engine: (codes.first_error, codes.first_error_message, codes.first_error_help) + for engine, codes in emitted.items() + } == { + engine: ( + test_case.expected_error_case.expected_code, + test_case.expected_error_case.expected_message, + test_case.expected_error_case.expected_help, + ) + for engine in _ENGINES + } + + +if __name__ == "__main__": + pytest.main([__file__, "-vv"]) diff --git a/tests/e2e/scripts/compiler_differential/test_golden_outputs.py b/tests/e2e/scripts/compiler_differential/test_golden_outputs.py new file mode 100644 index 0000000000..493038863e --- /dev/null +++ b/tests/e2e/scripts/compiler_differential/test_golden_outputs.py @@ -0,0 +1,76 @@ +"""Goldens recorded from the oracle pass an unchanged check and pinpoint any edited output.""" + +from __future__ import annotations + +from pathlib import Path + +import pytest + +from scripts.compiler_differential.main.differential import run_compiler_differential +from tests.e2e.scripts.compiler_differential._test_types import GoldenOutputTestCase +from tests.e2e.scripts.compiler_differential.helpers import ( + harness_arguments, + write_failure_case_project, +) + +_CASE: str = "engine-error-week-date-cursor-start" +_PROJECT: str = "orders" +_ENGINE_ARGUMENTS: tuple[str, ...] = ("--engines", "python", "native", "--expect", "failure:P001") + + +@pytest.mark.parametrize( + "test_case", + [ + GoldenOutputTestCase( + description="unchanged_goldens_pass_for_both_engines", + golden_edit=("", ""), + expected_exit_code=0, + expected_lines=("Compiler differential passed: 1 projects identical",), + ), + GoldenOutputTestCase( + description="edited_error_text_fails_for_both_engines", + golden_edit=("hour must be in 0..23", "hour must be in 1..24"), + expected_exit_code=1, + expected_lines=( + " - golden (python) at /commands/0/diagnostics/0/message", + " - golden (native) at /commands/0/diagnostics/0/message", + "Compiler differential FAILED: 1 of 1 projects differ", + ), + ), + ], + ids=lambda case: case.description, +) +def test_given_recorded_goldens_when_checking_then_only_edited_outputs_differ( + test_case: GoldenOutputTestCase, tmp_path: Path, capsys: pytest.CaptureFixture[str] +) -> None: + project: Path = write_failure_case_project(tmp_path / _PROJECT, name=_CASE) + golden_dir: Path = tmp_path / "goldens" + recorded: int = run_compiler_differential( + harness_arguments( + work_dir=tmp_path / "record", + project=project, + extra=(*_ENGINE_ARGUMENTS, "--goldens", "update", "--golden-dir", str(golden_dir)), + ) + ) + golden: Path = golden_dir / "project" / f"{_PROJECT}.json" + _ = golden.write_text( + golden.read_text(encoding="utf-8").replace(*test_case.golden_edit), encoding="utf-8" + ) + _ = capsys.readouterr() + + exit_code: int = run_compiler_differential( + harness_arguments( + work_dir=tmp_path / "check", + project=project, + extra=(*_ENGINE_ARGUMENTS, "--goldens", "check", "--golden-dir", str(golden_dir)), + ) + ) + + output: str = capsys.readouterr().out + assert recorded == 0 + assert exit_code == test_case.expected_exit_code, output + assert all(line in output for line in test_case.expected_lines), output + + +if __name__ == "__main__": + pytest.main([__file__, "-vv"]) diff --git a/tests/e2e/scripts/compiler_differential/test_native_fallback_gate.py b/tests/e2e/scripts/compiler_differential/test_native_fallback_gate.py new file mode 100644 index 0000000000..822f9e1a20 --- /dev/null +++ b/tests/e2e/scripts/compiler_differential/test_native_fallback_gate.py @@ -0,0 +1,193 @@ +"""The fallback allow-list gate fails on sabotaged native stages and on stale entries.""" + +from __future__ import annotations + +from pathlib import Path + +import pytest + +from scripts.compiler_differential.main.differential import run_compiler_differential +from tests.e2e.scripts.compiler_differential._test_types import NativeFallbackGateTestCase +from tests.e2e.scripts.compiler_differential.helpers import ( + MODEL_ANALYSIS_SABOTAGE, + REFERENCE_SCAN_SABOTAGE, + harness_arguments, + stage_disable_sabotage, + write_native_perturbation, +) + +_WAFFLE_SHOP_NATIVE_STAGES: tuple[str, ...] = ( + "attachments", + "contracts", + "declaration_files", + "declaration_scopes", + "lineage_facts", + "macro_call_store", + "macro_calls", + "model_analysis", + "model_config", + "model_loop", + "reference_extraction", + "semantic_checks", +) +_ANSWER_VANISHED: str = "native no longer answers here, so this work now runs in Python" +_FALLBACK_WITHOUT_ANSWERS: str = ( + "fallback disappeared but native answers did not appear; the stage may be switched off" +) +_VANISHED_ENTRY: str = ( + '\n[[entry]]\nengine = "native-preview"\nstage = "reference_extraction"\n' + 'site = "reference_extraction.scan"\nkind = "deferred"\ncounts = { project = 1 }\n' +) + + +@pytest.mark.parametrize( + "test_case", + [ + NativeFallbackGateTestCase( + description="recorded_list_passes", + perturbation="", + appended_entries="", + expected_exit_code=0, + expected_lines=("Compiler differential passed: 1 projects identical",), + ), + NativeFallbackGateTestCase( + description="entry_that_no_longer_occurs_without_new_native_answers_fails", + perturbation="", + appended_entries=_VANISHED_ENTRY, + expected_exit_code=1, + expected_lines=( + "Native fallback allow-list: native-preview reference_extraction " + f"reference_extraction.scan deferred (project): {_FALLBACK_WITHOUT_ANSWERS}", + ), + ), + NativeFallbackGateTestCase( + description="shipped_reference_scan_sabotaged_to_python_fails", + perturbation=REFERENCE_SCAN_SABOTAGE, + appended_entries="", + expected_exit_code=1, + expected_lines=( + "Native fallback allow-list: native-preview reference_extraction " + "reference_extraction.scan deferred (project): ", + "not on the allow-list; port it or list it with a reason", + ), + ), + NativeFallbackGateTestCase( + description="preview_model_analysis_sabotaged_to_python_fails", + perturbation=MODEL_ANALYSIS_SABOTAGE, + appended_entries="", + expected_exit_code=1, + expected_lines=( + "Native fallback allow-list: native-preview model_analysis analysis_session " + "session (project): ", + "Compiler differential FAILED: 0 of 1 projects differ", + ), + ), + NativeFallbackGateTestCase( + description="shipped_stages_switched_to_python_fail", + perturbation=stage_disable_sabotage(("reference_extraction", "declaration_files")), + appended_entries="", + expected_exit_code=1, + expected_lines=( + "Native fallback allow-list: native-preview reference_extraction " + f"reference_extraction.native reference_scans (project): {_ANSWER_VANISHED}", + "Native fallback allow-list: native-preview declaration_files " + f"declaration_files.native parsed_files (project): {_ANSWER_VANISHED}", + "Intended? Run `make compiler-baselines`", + ), + ), + NativeFallbackGateTestCase( + description="every_native_stage_switched_to_python_fails_by_name", + perturbation=stage_disable_sabotage(_WAFFLE_SHOP_NATIVE_STAGES), + appended_entries="", + expected_exit_code=1, + expected_lines=tuple( + f"Native fallback allow-list: native-preview {stage} {stage}.native " + for stage in _WAFFLE_SHOP_NATIVE_STAGES + ), + ), + ], + ids=lambda case: case.description, +) +def test_given_recorded_allow_list_when_native_defers_more_or_less_then_the_gate_fails( + test_case: NativeFallbackGateTestCase, tmp_path: Path, capsys: pytest.CaptureFixture[str] +) -> None: + allow_list: Path = tmp_path / "native_fallbacks.toml" + recorded: int = run_compiler_differential( + harness_arguments( + work_dir=tmp_path / "record", + extra=("--native-fallbacks", "update", "--native-fallback-list", str(allow_list)), + ) + ) + _ = allow_list.write_text( + allow_list.read_text(encoding="utf-8") + test_case.appended_entries, encoding="utf-8" + ) + sabotage: Path = write_native_perturbation(tmp_path / "sabotage", source=test_case.perturbation) + _ = capsys.readouterr() + + exit_code: int = run_compiler_differential( + harness_arguments( + work_dir=tmp_path / "check", + extra=( + "--native-fallbacks", + "check", + "--native-fallback-list", + str(allow_list), + "--engine-env", + f"native-preview:PYTHONPATH={sabotage}", + ), + ) + ) + + output: str = capsys.readouterr().out + assert recorded == 0 + assert exit_code == test_case.expected_exit_code, output + assert all(line in output for line in test_case.expected_lines), output + + +@pytest.mark.parametrize( + "test_case", + [ + NativeFallbackGateTestCase( + description="sql_test_glue_switched_off_is_not_a_finished_port", + perturbation=stage_disable_sabotage(("sql_test_glue",)), + appended_entries="", + expected_exit_code=1, + expected_lines=( + "Native fallback allow-list: native-preview sql_test_glue sql_test_glue.assembly " + f"deferred (fixture): {_FALLBACK_WITHOUT_ANSWERS}", + "Native fallback allow-list: native-preview sql_test_glue sql_test_glue.native " + f"sql_test_plans (fixture): {_ANSWER_VANISHED}", + "Native fallback allow-list: 2 problems", + ), + ), + ], + ids=lambda case: case.description, +) +def test_given_committed_allow_list_when_fallback_only_stage_is_switched_off_then_gate_refuses( + test_case: NativeFallbackGateTestCase, tmp_path: Path, capsys: pytest.CaptureFixture[str] +) -> None: + sabotage: Path = write_native_perturbation(tmp_path / "sabotage", source=test_case.perturbation) + _ = capsys.readouterr() + + exit_code: int = run_compiler_differential( + [ + "--corpus", + "fixtures", + "--jobs", + "2", + "--work-dir", + str(tmp_path / "check"), + "--native-fallbacks", + "check", + "--engine-env", + f"native-preview:PYTHONPATH={sabotage}", + ] + ) + + output: str = capsys.readouterr().out + assert exit_code == test_case.expected_exit_code, output + assert all(line in output for line in test_case.expected_lines), output + + +if __name__ == "__main__": + pytest.main([__file__, "-vv"]) diff --git a/tests/goldens/compiler/example/hero-shop.json b/tests/goldens/compiler/example/hero-shop.json new file mode 100644 index 0000000000..e9235feb79 --- /dev/null +++ b/tests/goldens/compiler/example/hero-shop.json @@ -0,0 +1,220 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-store-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "models/finance/daily_revenue.sql": [ + "SELECT", + " CAST(paid_at AS DATE) AS revenue_date,", + " SUM(amount_cents) AS total_revenue_cents", + "FROM __seed(\"payments\")", + "GROUP BY", + " CAST(paid_at AS DATE)", + "" + ] + }, + "manifest": { + "nodes": { + "model.waffle_shop.daily_revenue": { + "database": null, + "schema": "prod", + "name": "daily_revenue", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/finance/daily_revenue.sql", + "original_file_path": "models/finance/daily_revenue.sql", + "unique_id": "model.waffle_shop.daily_revenue", + "fqn": [ + "waffle_shop", + "models", + "finance", + "daily_revenue" + ], + "alias": "daily_revenue", + "config": { + "enabled": true, + "alias": null, + "schema": "prod", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Daily revenue from successful payments", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "prod.daily_revenue", + "depends_on": { + "macros": [], + "nodes": [ + "seed.waffle_shop.payments" + ] + } + }, + "seed.waffle_shop.payments": { + "database": null, + "schema": "prod", + "name": "payments", + "resource_type": "seed", + "package_name": "waffle_shop", + "path": "seeds/payments.csv", + "original_file_path": "seeds/payments.csv", + "unique_id": "seed.waffle_shop.payments", + "fqn": [ + "waffle_shop", + "seeds", + "payments" + ], + "alias": "payments", + "config": { + "enabled": true, + "alias": null, + "schema": "prod", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "seed", + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + }, + "delimiter": ",", + "quote_columns": null + }, + "tags": [], + "description": "Successful payments.", + "columns": { + "payment_id": { + "name": "payment_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "paid_at": { + "name": "paid_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount_cents": { + "name": "amount_cents", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "prod.payments", + "root_path": null, + "depends_on": { + "macros": [] + } + } + }, + "sources": {}, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.waffle_shop.daily_revenue": [ + "seed.waffle_shop.payments" + ], + "seed.waffle_shop.payments": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/example/tidy-shop.json b/tests/goldens/compiler/example/tidy-shop.json new file mode 100644 index 0000000000..c7db14dd9c --- /dev/null +++ b/tests/goldens/compiler/example/tidy-shop.json @@ -0,0 +1,115 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-store-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "models/daily_revenue.sql": [ + "SELECT CAST('2026-04-01' AS DATE) AS revenue_date, 2850 AS total_revenue_cents", + "" + ] + }, + "manifest": { + "nodes": { + "model.waffle_shop.daily_revenue": { + "database": null, + "schema": "prod", + "name": "daily_revenue", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/daily_revenue.sql", + "original_file_path": "models/daily_revenue.sql", + "unique_id": "model.waffle_shop.daily_revenue", + "fqn": [ + "waffle_shop", + "models", + "daily_revenue" + ], + "alias": "daily_revenue", + "config": { + "enabled": true, + "alias": null, + "schema": "prod", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Daily revenue from successful payments", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "prod.daily_revenue", + "depends_on": { + "macros": [], + "nodes": [] + } + } + }, + "sources": {}, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.waffle_shop.daily_revenue": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/example/waffle-shop.json b/tests/goldens/compiler/example/waffle-shop.json new file mode 100644 index 0000000000..e18976bf03 --- /dev/null +++ b/tests/goldens/compiler/example/waffle-shop.json @@ -0,0 +1,2136 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-store-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "audits/generic/customer_status_snapshot/not_null__customer_id.sql": [ + "SELECT customer_id", + "FROM __ref(\"customer_status_snapshot\")", + "WHERE customer_id IS NULL", + "" + ], + "audits/generic/customer_status_snapshot/unique__customer_id.sql": [ + "SELECT customer_id, COUNT(*) AS duplicate_count", + "FROM __ref(\"customer_status_snapshot\")", + "WHERE customer_id IS NOT NULL", + "GROUP BY customer_id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/daily_order_partitioned/not_null__order_date.sql": [ + "SELECT order_date", + "FROM __ref(\"daily_order_partitioned\")", + "WHERE order_date IS NULL", + "" + ], + "audits/generic/daily_order_partitioned/waffles_ordered_is_positive.sql": [ + "SELECT *", + "FROM __ref(\"daily_order_partitioned\")", + "WHERE NOT (waffles_ordered > 0)", + "" + ], + "audits/generic/daily_order_rollup/daily_orders_placed_is_non_negative.sql": [ + "SELECT *", + "FROM __ref(\"daily_order_rollup\")", + "WHERE NOT (orders_placed >= 0)", + "" + ], + "audits/generic/daily_order_rollup/not_null__activity_day.sql": [ + "SELECT activity_day", + "FROM __ref(\"daily_order_rollup\")", + "WHERE activity_day IS NULL", + "" + ], + "audits/generic/daily_revenue/revenue_is_non_negative.sql": [ + "SELECT *", + "FROM __ref(\"daily_revenue\")", + "WHERE NOT (total_revenue_cents >= 0)", + "" + ], + "audits/generic/dim_customers/not_null__customer_id.sql": [ + "SELECT customer_id", + "FROM __ref(\"dim_customers\")", + "WHERE customer_id IS NULL", + "" + ], + "audits/generic/dim_customers/unique__customer_id.sql": [ + "SELECT customer_id, COUNT(*) AS duplicate_count", + "FROM __ref(\"dim_customers\")", + "WHERE customer_id IS NOT NULL", + "GROUP BY customer_id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/fact_orders/not_null__order_id.sql": [ + "SELECT order_id", + "FROM __ref(\"fact_orders\")", + "WHERE order_id IS NULL", + "" + ], + "audits/generic/hourly_activity_with_daily_context/day_orders_cover_hourly_orders.sql": [ + "SELECT *", + "FROM __ref(\"hourly_activity_with_daily_context\")", + "WHERE NOT (day_orders_placed >= orders_placed)", + "" + ], + "audits/generic/hourly_activity_with_daily_context/not_null__activity_hour.sql": [ + "SELECT activity_hour", + "FROM __ref(\"hourly_activity_with_daily_context\")", + "WHERE activity_hour IS NULL", + "" + ], + "audits/generic/hourly_order_activity/not_null__activity_hour.sql": [ + "SELECT activity_hour", + "FROM __ref(\"hourly_order_activity\")", + "WHERE activity_hour IS NULL", + "" + ], + "audits/generic/hourly_order_activity/orders_placed_is_non_negative.sql": [ + "SELECT *", + "FROM __ref(\"hourly_order_activity\")", + "WHERE NOT (orders_placed >= 0)", + "" + ], + "audits/generic/order_status_index/not_null__order_id.sql": [ + "SELECT order_id", + "FROM __ref(\"order_status_index\")", + "WHERE order_id IS NULL", + "" + ], + "audits/generic/order_status_index/unique__order_id.sql": [ + "SELECT order_id, COUNT(*) AS duplicate_count", + "FROM __ref(\"order_status_index\")", + "WHERE order_id IS NOT NULL", + "GROUP BY order_id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/stg_customers/not_null__customer_id.sql": [ + "SELECT customer_id", + "FROM __ref(\"stg_customers\")", + "WHERE customer_id IS NULL", + "" + ], + "audits/generic/stg_customers/not_null__email.sql": [ + "SELECT email", + "FROM __ref(\"stg_customers\")", + "WHERE email IS NULL", + "" + ], + "audits/generic/stg_customers/unique__customer_id.sql": [ + "SELECT customer_id, COUNT(*) AS duplicate_count", + "FROM __ref(\"stg_customers\")", + "WHERE customer_id IS NOT NULL", + "GROUP BY customer_id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/stg_orders/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"stg_orders\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'preparing', 'ready', 'completed', 'cancelled')", + "" + ], + "audits/generic/stg_orders/not_null__customer_id.sql": [ + "SELECT customer_id", + "FROM __ref(\"stg_orders\")", + "WHERE customer_id IS NULL", + "" + ], + "audits/generic/stg_orders/not_null__order_id.sql": [ + "SELECT order_id", + "FROM __ref(\"stg_orders\")", + "WHERE order_id IS NULL", + "" + ], + "audits/generic/stg_orders/relationships__waffle_type_id.sql": [ + "SELECT waffle_type_id", + "FROM __ref(\"stg_orders\")", + "WHERE waffle_type_id IS NOT NULL", + " AND waffle_type_id NOT IN (", + " SELECT waffle_type_id", + " FROM __seed(\"waffle_types\")", + " WHERE waffle_type_id IS NOT NULL", + " )", + "" + ], + "audits/generic/stg_orders/unique__order_id.sql": [ + "SELECT order_id, COUNT(*) AS duplicate_count", + "FROM __ref(\"stg_orders\")", + "WHERE order_id IS NOT NULL", + "GROUP BY order_id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/stg_payments/not_null__order_id.sql": [ + "SELECT order_id", + "FROM __ref(\"stg_payments\")", + "WHERE order_id IS NULL", + "" + ], + "audits/generic/stg_payments/not_null__payment_id.sql": [ + "SELECT payment_id", + "FROM __ref(\"stg_payments\")", + "WHERE payment_id IS NULL", + "" + ], + "audits/generic/stg_payments/relationships__order_id.sql": [ + "SELECT order_id", + "FROM __ref(\"stg_payments\")", + "WHERE order_id IS NOT NULL", + " AND order_id NOT IN (", + " SELECT id", + " FROM __source(\"raw__orders\")", + " WHERE id IS NOT NULL", + " )", + "" + ], + "audits/generic/stg_payments/unique__payment_id.sql": [ + "SELECT payment_id, COUNT(*) AS duplicate_count", + "FROM __ref(\"stg_payments\")", + "WHERE payment_id IS NOT NULL", + "GROUP BY payment_id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/waffle_types/not_null__waffle_type_id.sql": [ + "SELECT waffle_type_id", + "FROM __seed(\"waffle_types\")", + "WHERE waffle_type_id IS NULL", + "" + ], + "audits/generic/waffle_types/unique__waffle_type_id.sql": [ + "SELECT waffle_type_id, COUNT(*) AS duplicate_count", + "FROM __seed(\"waffle_types\")", + "WHERE waffle_type_id IS NOT NULL", + "GROUP BY waffle_type_id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/singular/fact_orders_have_customers.sql": [ + "SELECT f.order_id, f.customer_id", + "FROM __ref(\"fact_orders\") f", + "LEFT JOIN __ref(\"dim_customers\") d ON f.customer_id = d.customer_id", + "WHERE d.customer_id IS NULL", + "" + ], + "functions/sql/table_fn__customer_orders.sql": [ + "CREATE OR REPLACE MACRO dev.table_fn__customer_orders(p_customer_id) AS TABLE", + "SELECT", + " order_id,", + " ordered_at,", + " waffle_name,", + " line_total_cents,", + " order_status,", + " is_completed_order", + "FROM __ref(\"fact_orders\")", + "WHERE customer_id = p_customer_id", + "" + ], + "functions/sql/udf__is_completed_order.sql": [ + "CREATE OR REPLACE MACRO dev.udf__is_completed_order(order_status) AS (", + "order_status = 'completed'", + ")", + "" + ], + "models/intermediate/customer_status_snapshot.sql": [ + "SELECT", + " customer_id,", + " MAX(ordered_at) AS last_ordered_at,", + " MAX(order_status) AS latest_order_status,", + " COUNT(*) AS total_orders,", + " SUM(line_total_cents) AS total_revenue_cents", + "FROM __ref(\"fact_orders\")", + "GROUP BY customer_id", + "" + ], + "models/intermediate/order_status_index.sql": [ + "SELECT", + " order_id,", + " customer_id,", + " order_status,", + " ordered_at,", + " line_total_cents", + "FROM __ref(\"fact_orders\")", + "" + ], + "models/marts/daily_order_partitioned.sql": [ + "SELECT", + " CAST(o.ordered_at AS DATE) AS order_date,", + " COUNT(DISTINCT o.order_id) AS order_count,", + " SUM(o.quantity) AS waffles_ordered,", + " COUNT(DISTINCT o.customer_id) AS unique_customers", + "FROM __ref(\"stg_orders\") o", + "WHERE CAST(o.ordered_at AS DATE) >= CAST(@@@partition_start AS DATE)", + " AND CAST(o.ordered_at AS DATE) < CAST(@@@partition_end AS DATE)", + "GROUP BY CAST(o.ordered_at AS DATE)", + "" + ], + "models/marts/daily_order_rollup.sql": [ + "SELECT", + " DATE_TRUNC('day', activity_hour) AS activity_day,", + " SUM(orders_placed) AS orders_placed,", + " SUM(waffles_ordered) AS waffles_ordered,", + " SUM(revenue_cents) AS revenue_cents", + "FROM __ref(\"hourly_order_activity\")", + "GROUP BY DATE_TRUNC('day', activity_hour)", + "" + ], + "models/marts/daily_revenue.sql": [ + "SELECT", + " CAST(o.ordered_at AS DATE) AS revenue_date,", + " COUNT(DISTINCT o.order_id) AS order_count,", + " SUM(o.quantity) AS waffles_sold,", + " SUM(p.amount_cents) AS total_revenue_cents,", + " ROUND((SUM(p.amount_cents)) / 100.0, 2) AS total_revenue_dollars,", + " SUM(p.amount_cents) / COUNT(DISTINCT o.order_id) AS avg_order_value_cents", + "FROM __ref(\"stg_orders\") o", + "INNER JOIN __ref(\"stg_payments\") p ON o.order_id = p.order_id AND p.payment_status = 'success'", + "GROUP BY CAST(o.ordered_at AS DATE)", + "" + ], + "models/marts/dim_customers.sql": [ + "SELECT", + " c.customer_id,", + " c.first_name,", + " c.last_name,", + " c.email,", + " c.created_at AS customer_since,", + " COUNT(DISTINCT o.order_id) AS lifetime_orders,", + " COALESCE(SUM(p.amount_cents), 0) AS lifetime_spend_cents", + "FROM __ref(\"stg_customers\") c", + "LEFT JOIN __ref(\"stg_orders\") o ON c.customer_id = o.customer_id", + "LEFT JOIN __ref(\"stg_payments\") p ON o.order_id = p.order_id AND p.payment_status = 'success'", + "GROUP BY c.customer_id, c.first_name, c.last_name, c.email, c.created_at", + "" + ], + "models/marts/fact_orders.sql": [ + "SELECT", + " o.order_id,", + " o.customer_id,", + " o.waffle_type_id,", + " w.waffle_name,", + " w.category AS waffle_category,", + " o.quantity,", + " w.price_cents * o.quantity AS line_total_cents,", + " o.ordered_at,", + " o.status AS order_status,", + " __udf(\"udf__is_completed_order\")(o.status) AS is_completed_order,", + " p.payment_method,", + " p.payment_status,", + " p.amount_cents AS payment_amount_cents", + "FROM __ref(\"stg_orders\") o", + "LEFT JOIN __seed(\"waffle_types\") w ON o.waffle_type_id = w.waffle_type_id", + "LEFT JOIN __ref(\"stg_payments\") p ON o.order_id = p.order_id", + "" + ], + "models/marts/hourly_activity_with_daily_context.sql": [ + "SELECT", + " h.activity_hour,", + " h.orders_placed,", + " d.orders_placed AS day_orders_placed,", + " h.waffles_ordered,", + " h.revenue_cents", + "FROM __ref(\"hourly_order_activity\") h", + "INNER JOIN __ref(\"daily_order_rollup\") d", + " ON DATE_TRUNC('day', h.activity_hour) = d.activity_day", + "" + ], + "models/marts/hourly_order_activity.sql": [ + "SELECT", + " DATE_TRUNC('hour', o.ordered_at) AS activity_hour,", + " COUNT(*) AS orders_placed,", + " SUM(o.quantity) AS waffles_ordered,", + " SUM(o.line_total_cents) AS revenue_cents", + "FROM __ref(\"fact_orders\") o", + "GROUP BY DATE_TRUNC('hour', o.ordered_at)", + "" + ], + "models/staging/stg_customers.sql": [ + "SELECT", + " id AS customer_id,", + " first_name,", + " last_name,", + " email,", + " created_at", + "FROM __source(\"raw__customers\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT", + " id AS order_id,", + " customer_id,", + " waffle_type_id,", + " quantity,", + " ordered_at,", + " status", + "FROM __source(\"raw__orders\")", + "" + ], + "models/staging/stg_payments.sql": [ + "SELECT", + " id AS payment_id,", + " order_id,", + " amount_cents,", + " payment_method,", + " paid_at,", + " status AS payment_status", + "FROM __source(\"raw__payments\")", + "" + ], + "tests/_chain_/daily_revenue__stg_orders__stg_payments/test_daily_revenue_chain.sql": [ + "WITH __source__raw__orders AS (SELECT", + " 1 AS id,", + " 100 AS customer_id,", + " 2 AS waffle_type_id,", + " 3 AS quantity,", + " CAST('2026-04-01 10:00:00' AS TIMESTAMP) AS ordered_at,", + " 'completed' AS status", + " UNION ALL", + " SELECT", + " 2 AS id,", + " 101 AS customer_id,", + " 1 AS waffle_type_id,", + " 1 AS quantity,", + " CAST('2026-04-01 11:00:00' AS TIMESTAMP) AS ordered_at,", + " 'completed' AS status),", + "__ref__stg_orders AS (SELECT", + " id AS order_id,", + " customer_id,", + " waffle_type_id,", + " quantity,", + " ordered_at,", + " status", + "FROM __source__raw__orders),", + "__source__raw__payments AS (SELECT", + " 10 AS id,", + " 1 AS order_id,", + " 2850 AS amount_cents,", + " 'card' AS payment_method,", + " CAST('2026-04-01 10:05:00' AS TIMESTAMP) AS paid_at,", + " 'success' AS status", + " UNION ALL", + " SELECT", + " 11 AS id,", + " 2 AS order_id,", + " 850 AS amount_cents,", + " 'cash' AS payment_method,", + " CAST('2026-04-01 11:10:00' AS TIMESTAMP) AS paid_at,", + " 'failed' AS status),", + "__ref__stg_payments AS (SELECT", + " id AS payment_id,", + " order_id,", + " amount_cents,", + " payment_method,", + " paid_at,", + " status AS payment_status", + "FROM __source__raw__payments),", + "__ref__daily_revenue AS (SELECT", + " CAST(o.ordered_at AS DATE) AS revenue_date,", + " COUNT(DISTINCT o.order_id) AS order_count,", + " SUM(o.quantity) AS waffles_sold,", + " SUM(p.amount_cents) AS total_revenue_cents,", + " ROUND((SUM(p.amount_cents)) / 100.0, 2) AS total_revenue_dollars,", + " SUM(p.amount_cents) / COUNT(DISTINCT o.order_id) AS avg_order_value_cents", + "FROM __ref__stg_orders o", + "INNER JOIN __ref__stg_payments p ON o.order_id = p.order_id AND p.payment_status = 'success'", + "GROUP BY CAST(o.ordered_at AS DATE)),", + "__actual__stg_orders AS (SELECT * FROM __ref__stg_orders),", + "__expected__stg_orders AS (SELECT", + " 1 AS order_id,", + " 100 AS customer_id,", + " 2 AS waffle_type_id,", + " 3 AS quantity,", + " CAST('2026-04-01 10:00:00' AS TIMESTAMP) AS ordered_at,", + " 'completed' AS status", + " UNION ALL", + " SELECT", + " 2 AS order_id,", + " 101 AS customer_id,", + " 1 AS waffle_type_id,", + " 1 AS quantity,", + " CAST('2026-04-01 11:00:00' AS TIMESTAMP) AS ordered_at,", + " 'completed' AS status),", + "__actual__stg_payments AS (SELECT * FROM __ref__stg_payments),", + "__expected__stg_payments AS (SELECT", + " 10 AS payment_id,", + " 1 AS order_id,", + " 2850 AS amount_cents,", + " 'card' AS payment_method,", + " CAST('2026-04-01 10:05:00' AS TIMESTAMP) AS paid_at,", + " 'success' AS payment_status", + " UNION ALL", + " SELECT", + " 11 AS payment_id,", + " 2 AS order_id,", + " 850 AS amount_cents,", + " 'cash' AS payment_method,", + " CAST('2026-04-01 11:10:00' AS TIMESTAMP) AS paid_at,", + " 'failed' AS payment_status),", + "__actual__daily_revenue AS (SELECT * FROM __ref__daily_revenue),", + "__expected__daily_revenue AS (SELECT", + " CAST('2026-04-01' AS DATE) AS revenue_date,", + " 1 AS order_count,", + " 3 AS waffles_sold,", + " 2850 AS total_revenue_cents,", + " 28.5 AS total_revenue_dollars,", + " 2850 AS avg_order_value_cents),", + "__assert__daily_revenue_is_non_negative AS (SELECT *", + " FROM __ref__daily_revenue", + " WHERE total_revenue_cents < 0)", + "SELECT 0 AS step_index, 'stg_orders' AS model_name, (SELECT COUNT(*) FROM __actual__stg_orders) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_orders) AS expected_count, (SELECT COUNT(*) FROM (SELECT order_id, customer_id, waffle_type_id, quantity, ordered_at, status FROM __actual__stg_orders EXCEPT SELECT order_id, customer_id, waffle_type_id, quantity, ordered_at, status FROM __expected__stg_orders) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT order_id, customer_id, waffle_type_id, quantity, ordered_at, status FROM __expected__stg_orders EXCEPT SELECT order_id, customer_id, waffle_type_id, quantity, ordered_at, status FROM __actual__stg_orders) AS __sqlbuild_missing) AS missing_count", + "UNION ALL", + "SELECT 1 AS step_index, 'stg_payments' AS model_name, (SELECT COUNT(*) FROM __actual__stg_payments) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_payments) AS expected_count, (SELECT COUNT(*) FROM (SELECT payment_id, order_id, amount_cents, payment_method, paid_at, payment_status FROM __actual__stg_payments EXCEPT SELECT payment_id, order_id, amount_cents, payment_method, paid_at, payment_status FROM __expected__stg_payments) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT payment_id, order_id, amount_cents, payment_method, paid_at, payment_status FROM __expected__stg_payments EXCEPT SELECT payment_id, order_id, amount_cents, payment_method, paid_at, payment_status FROM __actual__stg_payments) AS __sqlbuild_missing) AS missing_count", + "UNION ALL", + "SELECT 2 AS step_index, 'daily_revenue' AS model_name, (SELECT COUNT(*) FROM __actual__daily_revenue) AS actual_count, (SELECT COUNT(*) FROM __expected__daily_revenue) AS expected_count, (SELECT COUNT(*) FROM (SELECT revenue_date, order_count, waffles_sold, total_revenue_cents, total_revenue_dollars, avg_order_value_cents FROM __actual__daily_revenue EXCEPT SELECT revenue_date, order_count, waffles_sold, total_revenue_cents, total_revenue_dollars, avg_order_value_cents FROM __expected__daily_revenue) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT revenue_date, order_count, waffles_sold, total_revenue_cents, total_revenue_dollars, avg_order_value_cents FROM __expected__daily_revenue EXCEPT SELECT revenue_date, order_count, waffles_sold, total_revenue_cents, total_revenue_dollars, avg_order_value_cents FROM __actual__daily_revenue) AS __sqlbuild_missing) AS missing_count", + "UNION ALL", + "SELECT 3 AS step_index, 'assertion daily_revenue_is_non_negative' AS model_name, (SELECT COUNT(*) FROM __assert__daily_revenue_is_non_negative) AS actual_count, 0 AS expected_count, (SELECT COUNT(*) FROM __assert__daily_revenue_is_non_negative) AS unexpected_count, 0 AS missing_count", + "" + ], + "tests/fact_orders/test_fact_orders.sql": [ + "WITH __ref__stg_orders AS (SELECT", + " 1 AS order_id,", + " 100 AS customer_id,", + " 2 AS waffle_type_id,", + " 3 AS quantity,", + " CAST('2026-04-01 10:00:00' AS TIMESTAMP) AS ordered_at,", + " 'completed' AS status),", + "__ref__stg_payments AS (SELECT", + " 10 AS payment_id,", + " 1 AS order_id,", + " 2850 AS amount_cents,", + " 'card' AS payment_method,", + " CAST('2026-04-01 10:05:00' AS TIMESTAMP) AS paid_at,", + " 'success' AS payment_status),", + "__seed__waffle_types AS (SELECT", + " 2 AS waffle_type_id,", + " 'Liege' AS waffle_name,", + " 'sweet' AS category,", + " 950 AS price_cents),", + "__ref__fact_orders AS (SELECT", + " o.order_id,", + " o.customer_id,", + " o.waffle_type_id,", + " w.waffle_name,", + " w.category AS waffle_category,", + " o.quantity,", + " w.price_cents * o.quantity AS line_total_cents,", + " o.ordered_at,", + " o.status AS order_status,", + " dev.udf__is_completed_order(o.status) AS is_completed_order,", + " p.payment_method,", + " p.payment_status,", + " p.amount_cents AS payment_amount_cents", + "FROM __ref__stg_orders o", + "LEFT JOIN __seed__waffle_types w ON o.waffle_type_id = w.waffle_type_id", + "LEFT JOIN __ref__stg_payments p ON o.order_id = p.order_id),", + "__actual__fact_orders AS (SELECT * FROM __ref__fact_orders),", + "__expected__fact_orders AS (SELECT", + " 1 AS order_id,", + " 100 AS customer_id,", + " 2 AS waffle_type_id,", + " 'Liege' AS waffle_name,", + " 'sweet' AS waffle_category,", + " 3 AS quantity,", + " 2850 AS line_total_cents,", + " CAST('2026-04-01 10:00:00' AS TIMESTAMP) AS ordered_at,", + " 'completed' AS order_status,", + " TRUE AS is_completed_order,", + " 'card' AS payment_method,", + " 'success' AS payment_status,", + " 2850 AS payment_amount_cents),", + "__assert__line_totals_are_non_negative AS (SELECT *", + " FROM __ref__fact_orders", + " WHERE line_total_cents < 0)", + "SELECT 0 AS step_index, 'fact_orders' AS model_name, (SELECT COUNT(*) FROM __actual__fact_orders) AS actual_count, (SELECT COUNT(*) FROM __expected__fact_orders) AS expected_count, (SELECT COUNT(*) FROM (SELECT order_id, customer_id, waffle_type_id, waffle_name, waffle_category, quantity, line_total_cents, ordered_at, order_status, is_completed_order, payment_method, payment_status, payment_amount_cents FROM __actual__fact_orders EXCEPT SELECT order_id, customer_id, waffle_type_id, waffle_name, waffle_category, quantity, line_total_cents, ordered_at, order_status, is_completed_order, payment_method, payment_status, payment_amount_cents FROM __expected__fact_orders) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT order_id, customer_id, waffle_type_id, waffle_name, waffle_category, quantity, line_total_cents, ordered_at, order_status, is_completed_order, payment_method, payment_status, payment_amount_cents FROM __expected__fact_orders EXCEPT SELECT order_id, customer_id, waffle_type_id, waffle_name, waffle_category, quantity, line_total_cents, ordered_at, order_status, is_completed_order, payment_method, payment_status, payment_amount_cents FROM __actual__fact_orders) AS __sqlbuild_missing) AS missing_count", + "UNION ALL", + "SELECT 1 AS step_index, 'assertion line_totals_are_non_negative' AS model_name, (SELECT COUNT(*) FROM __assert__line_totals_are_non_negative) AS actual_count, 0 AS expected_count, (SELECT COUNT(*) FROM __assert__line_totals_are_non_negative) AS unexpected_count, 0 AS missing_count", + "" + ], + "tests/macro calculates_line_total_cents/calculates_line_total_cents.sql": [ + "WITH input_values AS (SELECT 950 AS price_cents, 3 AS quantity),", + "__actual__macro_calculates_line_total_cents AS (SELECT price_cents * quantity AS line_total_cents", + " FROM input_values),", + "__expected__macro_calculates_line_total_cents AS (SELECT 2850 AS line_total_cents)", + "SELECT 0 AS step_index, 'macro calculates_line_total_cents' AS model_name, (SELECT COUNT(*) FROM __actual__macro_calculates_line_total_cents) AS actual_count, (SELECT COUNT(*) FROM __expected__macro_calculates_line_total_cents) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__macro_calculates_line_total_cents EXCEPT SELECT * FROM __expected__macro_calculates_line_total_cents) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__macro_calculates_line_total_cents EXCEPT SELECT * FROM __actual__macro_calculates_line_total_cents) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/stg_orders/test_stg_orders.sql": [ + "WITH __source__raw__orders AS (SELECT", + " 1 AS id,", + " 100 AS customer_id,", + " 2 AS waffle_type_id,", + " 3 AS quantity,", + " CAST('2026-04-01 10:00:00' AS TIMESTAMP) AS ordered_at,", + " 'completed' AS status),", + "__ref__stg_orders AS (SELECT", + " id AS order_id,", + " customer_id,", + " waffle_type_id,", + " quantity,", + " ordered_at,", + " status", + "FROM __source__raw__orders),", + "__actual__stg_orders AS (SELECT * FROM __ref__stg_orders),", + "__expected__stg_orders AS (SELECT", + " 1 AS order_id,", + " 100 AS customer_id,", + " 2 AS waffle_type_id,", + " 3 AS quantity,", + " CAST('2026-04-01 10:00:00' AS TIMESTAMP) AS ordered_at,", + " 'completed' AS status),", + "__assert__order_ids_are_not_null AS (SELECT *", + " FROM __ref__stg_orders", + " WHERE order_id IS NULL)", + "SELECT 0 AS step_index, 'stg_orders' AS model_name, (SELECT COUNT(*) FROM __actual__stg_orders) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_orders) AS expected_count, (SELECT COUNT(*) FROM (SELECT order_id, customer_id, waffle_type_id, quantity, ordered_at, status FROM __actual__stg_orders EXCEPT SELECT order_id, customer_id, waffle_type_id, quantity, ordered_at, status FROM __expected__stg_orders) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT order_id, customer_id, waffle_type_id, quantity, ordered_at, status FROM __expected__stg_orders EXCEPT SELECT order_id, customer_id, waffle_type_id, quantity, ordered_at, status FROM __actual__stg_orders) AS __sqlbuild_missing) AS missing_count", + "UNION ALL", + "SELECT 1 AS step_index, 'assertion order_ids_are_not_null' AS model_name, (SELECT COUNT(*) FROM __assert__order_ids_are_not_null) AS actual_count, 0 AS expected_count, (SELECT COUNT(*) FROM __assert__order_ids_are_not_null) AS unexpected_count, 0 AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.waffle_shop.customer_status_snapshot": { + "database": null, + "schema": "dev", + "name": "customer_status_snapshot", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/intermediate/customer_status_snapshot.sql", + "original_file_path": "models/intermediate/customer_status_snapshot.sql", + "unique_id": "model.waffle_shop.customer_status_snapshot", + "fqn": [ + "waffle_shop", + "models", + "intermediate", + "customer_status_snapshot" + ], + "alias": "customer_status_snapshot", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [ + "intermediate", + "acceptance" + ], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "merge", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "customer_id" + ], + "on_schema_change": "sync_all_columns", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "intermediate", + "acceptance" + ], + "description": "Merge-based customer snapshot with timestamp cursor and explicit backfill policies.", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.customer_status_snapshot", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.fact_orders" + ] + } + }, + "model.waffle_shop.order_status_index": { + "database": null, + "schema": "dev", + "name": "order_status_index", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/intermediate/order_status_index.sql", + "original_file_path": "models/intermediate/order_status_index.sql", + "unique_id": "model.waffle_shop.order_status_index", + "fqn": [ + "waffle_shop", + "models", + "intermediate", + "order_status_index" + ], + "alias": "order_status_index", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [ + "intermediate", + "acceptance" + ], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "order_id" + ], + "on_schema_change": "append_new_columns", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "intermediate", + "acceptance" + ], + "description": "Integer-cursor incremental projection over fact orders.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.order_status_index", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.fact_orders" + ] + } + }, + "model.waffle_shop.daily_order_partitioned": { + "database": null, + "schema": "dev", + "name": "daily_order_partitioned", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/daily_order_partitioned.sql", + "original_file_path": "models/marts/daily_order_partitioned.sql", + "unique_id": "model.waffle_shop.daily_order_partitioned", + "fqn": [ + "waffle_shop", + "models", + "marts", + "daily_order_partitioned" + ], + "alias": "daily_order_partitioned", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [ + "marts" + ], + "meta": {}, + "group": null, + "materialized": "partition_tracked", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts" + ], + "description": "Partition-tracked daily order summary using custom materialization.", + "columns": { + "order_date": { + "name": "order_date", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.daily_order_partitioned", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.stg_orders" + ] + } + }, + "model.waffle_shop.daily_order_rollup": { + "database": null, + "schema": "dev", + "name": "daily_order_rollup", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/daily_order_rollup.sql", + "original_file_path": "models/marts/daily_order_rollup.sql", + "unique_id": "model.waffle_shop.daily_order_rollup", + "fqn": [ + "waffle_shop", + "models", + "marts", + "daily_order_rollup" + ], + "alias": "daily_order_rollup", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [ + "marts", + "acceptance" + ], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts", + "acceptance" + ], + "description": "Downstream daily microbatch rollup with a wider batch size than its hourly upstream.", + "columns": { + "activity_day": { + "name": "activity_day", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.daily_order_rollup", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.hourly_order_activity" + ] + } + }, + "model.waffle_shop.daily_revenue": { + "database": null, + "schema": "dev", + "name": "daily_revenue", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/daily_revenue.sql", + "original_file_path": "models/marts/daily_revenue.sql", + "unique_id": "model.waffle_shop.daily_revenue", + "fqn": [ + "waffle_shop", + "models", + "marts", + "daily_revenue" + ], + "alias": "daily_revenue", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [ + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts" + ], + "description": "Daily revenue aggregation.", + "columns": { + "revenue_date": { + "name": "revenue_date", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.daily_revenue", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.stg_orders", + "model.waffle_shop.stg_payments" + ] + } + }, + "model.waffle_shop.dim_customers": { + "database": null, + "schema": "dev", + "name": "dim_customers", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/dim_customers.sql", + "original_file_path": "models/marts/dim_customers.sql", + "unique_id": "model.waffle_shop.dim_customers", + "fqn": [ + "waffle_shop", + "models", + "marts", + "dim_customers" + ], + "alias": "dim_customers", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [ + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "customer_id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts" + ], + "description": "Customer dimension with lifetime metrics.", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.dim_customers", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.stg_customers", + "model.waffle_shop.stg_orders", + "model.waffle_shop.stg_payments" + ] + } + }, + "model.waffle_shop.fact_orders": { + "database": null, + "schema": "dev", + "name": "fact_orders", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/fact_orders.sql", + "original_file_path": "models/marts/fact_orders.sql", + "unique_id": "model.waffle_shop.fact_orders", + "fqn": [ + "waffle_shop", + "models", + "marts", + "fact_orders" + ], + "alias": "fact_orders", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [ + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts" + ], + "description": "Order fact table with waffle and payment details.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.fact_orders", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.udf__is_completed_order", + "model.waffle_shop.stg_orders", + "seed.waffle_shop.waffle_types", + "model.waffle_shop.stg_payments" + ] + } + }, + "model.waffle_shop.hourly_activity_with_daily_context": { + "database": null, + "schema": "dev", + "name": "hourly_activity_with_daily_context", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/hourly_activity_with_daily_context.sql", + "original_file_path": "models/marts/hourly_activity_with_daily_context.sql", + "unique_id": "model.waffle_shop.hourly_activity_with_daily_context", + "fqn": [ + "waffle_shop", + "models", + "marts", + "hourly_activity_with_daily_context" + ], + "alias": "hourly_activity_with_daily_context", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [ + "marts", + "acceptance" + ], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts", + "acceptance" + ], + "description": "Hourly downstream microbatch model that depends on a coarser-grain daily upstream.", + "columns": { + "activity_hour": { + "name": "activity_hour", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.hourly_activity_with_daily_context", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.hourly_order_activity", + "model.waffle_shop.daily_order_rollup" + ] + } + }, + "model.waffle_shop.hourly_order_activity": { + "database": null, + "schema": "dev", + "name": "hourly_order_activity", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/hourly_order_activity.sql", + "original_file_path": "models/marts/hourly_order_activity.sql", + "unique_id": "model.waffle_shop.hourly_order_activity", + "fqn": [ + "waffle_shop", + "models", + "marts", + "hourly_order_activity" + ], + "alias": "hourly_order_activity", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [ + "marts" + ], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts" + ], + "description": "Hourly order activity aggregated via microbatch incremental.", + "columns": { + "activity_hour": { + "name": "activity_hour", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.hourly_order_activity", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.fact_orders" + ] + } + }, + "model.waffle_shop.stg_customers": { + "database": null, + "schema": "dev", + "name": "stg_customers", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/staging/stg_customers.sql", + "original_file_path": "models/staging/stg_customers.sql", + "unique_id": "model.waffle_shop.stg_customers", + "fqn": [ + "waffle_shop", + "models", + "staging", + "stg_customers" + ], + "alias": "stg_customers", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Cleaned customer records.", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "email": { + "name": "email", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.stg_customers", + "depends_on": { + "macros": [], + "nodes": [ + "source.waffle_shop.raw__customers" + ] + } + }, + "model.waffle_shop.stg_orders": { + "database": null, + "schema": "dev", + "name": "stg_orders", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.waffle_shop.stg_orders", + "fqn": [ + "waffle_shop", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Cleaned order records.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "waffle_type_id": { + "name": "waffle_type_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.waffle_shop.raw__orders" + ] + } + }, + "model.waffle_shop.stg_payments": { + "database": null, + "schema": "dev", + "name": "stg_payments", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/staging/stg_payments.sql", + "original_file_path": "models/staging/stg_payments.sql", + "unique_id": "model.waffle_shop.stg_payments", + "fqn": [ + "waffle_shop", + "models", + "staging", + "stg_payments" + ], + "alias": "stg_payments", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Cleaned payment records.", + "columns": { + "payment_id": { + "name": "payment_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.stg_payments", + "depends_on": { + "macros": [], + "nodes": [ + "source.waffle_shop.raw__payments" + ] + } + }, + "seed.waffle_shop.waffle_types": { + "database": null, + "schema": "dev", + "name": "waffle_types", + "resource_type": "seed", + "package_name": "waffle_shop", + "path": "seeds/waffle_types.csv", + "original_file_path": "seeds/waffle_types.csv", + "unique_id": "seed.waffle_shop.waffle_types", + "fqn": [ + "waffle_shop", + "seeds", + "waffle_types" + ], + "alias": "waffle_types", + "config": { + "enabled": true, + "alias": null, + "schema": "dev", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "seed", + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + }, + "delimiter": ",", + "quote_columns": null + }, + "tags": [], + "description": "Waffle menu items with pricing.", + "columns": { + "waffle_type_id": { + "name": "waffle_type_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "waffle_name": { + "name": "waffle_name", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "category": { + "name": "category", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "price_cents": { + "name": "price_cents", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "dev.waffle_types", + "root_path": null, + "depends_on": { + "macros": [] + } + } + }, + "sources": { + "source.waffle_shop.raw__customers": { + "database": null, + "schema": "dev", + "name": "raw__customers", + "resource_type": "source", + "package_name": "waffle_shop", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.waffle_shop.raw__customers", + "fqn": [ + "waffle_shop", + "raw__customers" + ], + "source_name": "raw__customers", + "source_description": "", + "loader": "", + "identifier": "raw__customers", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Raw customer records loaded by the Python loader", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "first_name": { + "name": "first_name", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "last_name": { + "name": "last_name", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "email": { + "name": "email", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "raw__customers", + "auto_load": false, + "write_strategy": "table" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.waffle_shop.raw__orders": { + "database": null, + "schema": "dev", + "name": "raw__orders", + "resource_type": "source", + "package_name": "waffle_shop", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.waffle_shop.raw__orders", + "fqn": [ + "waffle_shop", + "raw__orders" + ], + "source_name": "raw__orders", + "source_description": "", + "loader": "", + "identifier": "raw__orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Raw order records loaded by the Python loader", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "waffle_type_id": { + "name": "waffle_type_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "quantity": { + "name": "quantity", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "ordered_at": { + "name": "ordered_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "raw__orders", + "auto_load": false, + "write_strategy": "delete_insert", + "cursor_column": "ordered_at" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.waffle_shop.raw__payments": { + "database": null, + "schema": "", + "name": "raw__payments", + "resource_type": "source", + "package_name": "waffle_shop", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.waffle_shop.raw__payments", + "fqn": [ + "waffle_shop", + "raw__payments" + ], + "source_name": "raw__payments", + "source_description": "", + "loader": "", + "identifier": "raw__payments", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Payment records for each order, defined inline", + "columns": { + "amount_cents": { + "name": "amount_cents", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.waffle_shop.line_total_cents": { + "name": "line_total_cents", + "resource_type": "macro", + "package_name": "waffle_shop", + "path": "macros/currency.py", + "original_file_path": "macros/currency.py", + "unique_id": "macro.waffle_shop.line_total_cents", + "macro_sql": "\"\"\"Project-wide currency macros.\"\"\"\n\n\ndef line_total_cents(price_cents: str, quantity: str) -> str:\n \"\"\"Calculate line total cents from a unit price and quantity.\"\"\"\n return f\"{price_cents} * {quantity}\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.waffle_shop.cents_to_dollars": { + "name": "cents_to_dollars", + "resource_type": "macro", + "package_name": "waffle_shop", + "path": "models/marts/_sqlbuild/_macros/currency.py", + "original_file_path": "models/marts/_sqlbuild/_macros/currency.py", + "unique_id": "macro.waffle_shop.cents_to_dollars", + "macro_sql": "\"\"\"Currency formatting macros.\"\"\"\n\n\ndef cents_to_dollars(column: str) -> str:\n \"\"\"Convert a cents integer column to a dollars decimal with two decimal places.\"\"\"\n return f\"ROUND(({column}) / 100.0, 2)\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/marts" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.waffle_shop.timestamp_trunc": { + "name": "timestamp_trunc", + "resource_type": "macro", + "package_name": "waffle_shop", + "path": "models/marts/_sqlbuild/_macros/datetime.py", + "original_file_path": "models/marts/_sqlbuild/_macros/datetime.py", + "unique_id": "macro.waffle_shop.timestamp_trunc", + "macro_sql": "\"\"\"Datetime portability macros.\"\"\"\n\n\ndef timestamp_trunc(ctx, grain: str, expr: str) -> str:\n if ctx.adapter_name == \"bigquery\":\n return f\"TIMESTAMP_TRUNC({expr}, {grain.upper()})\"\n return f\"DATE_TRUNC('{grain}', {expr})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/marts" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.waffle_shop.customer_status_snapshot": [ + "model.waffle_shop.fact_orders" + ], + "model.waffle_shop.order_status_index": [ + "model.waffle_shop.fact_orders" + ], + "model.waffle_shop.daily_order_partitioned": [ + "model.waffle_shop.stg_orders" + ], + "model.waffle_shop.daily_order_rollup": [ + "model.waffle_shop.hourly_order_activity" + ], + "model.waffle_shop.daily_revenue": [ + "model.waffle_shop.stg_orders", + "model.waffle_shop.stg_payments" + ], + "model.waffle_shop.dim_customers": [ + "model.waffle_shop.stg_customers", + "model.waffle_shop.stg_orders", + "model.waffle_shop.stg_payments" + ], + "model.waffle_shop.fact_orders": [ + "model.waffle_shop.udf__is_completed_order", + "model.waffle_shop.stg_orders", + "seed.waffle_shop.waffle_types", + "model.waffle_shop.stg_payments" + ], + "model.waffle_shop.hourly_activity_with_daily_context": [ + "model.waffle_shop.hourly_order_activity", + "model.waffle_shop.daily_order_rollup" + ], + "model.waffle_shop.hourly_order_activity": [ + "model.waffle_shop.fact_orders" + ], + "model.waffle_shop.stg_customers": [ + "source.waffle_shop.raw__customers" + ], + "model.waffle_shop.stg_orders": [ + "source.waffle_shop.raw__orders" + ], + "model.waffle_shop.stg_payments": [ + "source.waffle_shop.raw__payments" + ], + "source.waffle_shop.raw__customers": [], + "source.waffle_shop.raw__orders": [], + "source.waffle_shop.raw__payments": [], + "seed.waffle_shop.waffle_types": [], + "model.waffle_shop.table_fn__customer_orders": [ + "model.waffle_shop.fact_orders" + ], + "model.waffle_shop.udf__is_completed_order": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-accepted-values-type.json b/tests/goldens/compiler/failure/analysis-accepted-values-type.json new file mode 100644 index 0000000000..15c849fec9 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-accepted-values-type.json @@ -0,0 +1,308 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B301", + "message": "accepted_values: IN list contains an invalid coercible literal", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 4, + "column": 5, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 4, + "column": 5 + }, + "help": "align this declared metadata or audit value with the column or argument type" + }, + { + "phase": "compile", + "severity": "error", + "code": "B218", + "message": "audit 'accepted_values' on model 'customer_totals' column 'customer_id': IN list contains an invalid coercible literal", + "resource_type": "audit", + "resource_name": "accepted_values", + "path": "audits/generic/accepted_values.sql", + "line": 6, + "column": 30, + "location": { + "path": "audits/generic/accepted_values.sql", + "line": 6, + "column": 30, + "end_line": 7, + "end_column": 8 + }, + "help": "choose a supported source-to-target cast for this dialect" + } + ] + } + ], + "compiled": { + "audits/generic/customer_totals/accepted_values__customer_id.sql": [ + "SELECT customer_id", + "FROM __ref(\"customer_totals\")", + "WHERE customer_id IS NOT NULL", + " AND customer_id NOT IN ('DATE', '2026-01-01')", + "" + ], + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-aggregate-in-where.json b/tests/goldens/compiler/failure/analysis-aggregate-in-where.json new file mode 100644 index 0000000000..773acca307 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-aggregate-in-where.json @@ -0,0 +1,275 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B231", + "message": "Aggregate function is not allowed in this clause or inside another aggregate", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 11, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 11, + "end_line": 7, + "end_column": 17 + }, + "help": "move this aggregate to SELECT or HAVING, or compute it in an input CTE" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id", + "FROM __ref(\"stg_orders\")", + "WHERE SUM(amount) > 1", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-alias-column-list-width.json b/tests/goldens/compiler/failure/analysis-alias-column-list-width.json new file mode 100644 index 0000000000..119220384a --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-alias-column-list-width.json @@ -0,0 +1,273 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B005", + "message": "Derived-table column alias count exceeds its output column count", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 73, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 73, + "end_line": 6, + "end_column": 74 + }, + "help": "match the relation alias list to its available output columns" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT o.a AS first_column", + "FROM (SELECT order_id, customer_id FROM __ref(\"stg_orders\")) AS o(a, b, c)", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-ambiguous-column.json b/tests/goldens/compiler/failure/analysis-ambiguous-column.json new file mode 100644 index 0000000000..56297788ab --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-ambiguous-column.json @@ -0,0 +1,274 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B003", + "message": "Ambiguous unqualified column 'order_id' found in 2 referenced tables", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 8, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 8, + "end_line": 5, + "end_column": 16 + }, + "help": "qualify this column with the intended input alias" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT order_id", + "FROM __ref(\"stg_orders\") a", + "JOIN __ref(\"stg_orders\") b ON a.customer_id = b.customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-arithmetic-operands.json b/tests/goldens/compiler/failure/analysis-arithmetic-operands.json new file mode 100644 index 0000000000..eb60410254 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-arithmetic-operands.json @@ -0,0 +1,276 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B212", + "message": "Arithmetic operation expects NUMERIC-compatible operands, found STRING and INTEGER", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 21, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 21, + "end_line": 5, + "end_column": 31 + }, + "help": "use operands supported by this arithmetic operator, or convert them explicitly", + "notes": [ + "status is TEXT, 1 is INTEGER" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, status + 1 AS total_amount", + "FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-cursor-type-family.json b/tests/goldens/compiler/failure/analysis-cursor-type-family.json new file mode 100644 index 0000000000..207baf4a14 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-cursor-type-family.json @@ -0,0 +1,274 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B301", + "message": "cursor_type TIMESTAMP does not match column 'customer_id' type INT", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 15, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 15 + }, + "help": "align this declared metadata or audit value with the column or argument type" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "customer_id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-duplicate-cte-name.json b/tests/goldens/compiler/failure/analysis-duplicate-cte-name.json new file mode 100644 index 0000000000..ac30091e30 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-duplicate-cte-name.json @@ -0,0 +1,274 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B233", + "message": "Duplicate CTE name 'totals'", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 8, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 8, + "end_line": 7, + "end_column": 19 + }, + "help": "use distinct names for relations or CTEs within this scope" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "WITH totals AS (SELECT customer_id FROM __ref(\"stg_orders\")),", + "totals AS (SELECT customer_id FROM __ref(\"stg_orders\"))", + "SELECT customer_id FROM totals", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-expression-audit-unknown-column.json b/tests/goldens/compiler/failure/analysis-expression-audit-unknown-column.json new file mode 100644 index 0000000000..c34e4d80c9 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-expression-audit-unknown-column.json @@ -0,0 +1,295 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "Unknown column 'discount' in output", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 3, + "column": 43, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 3, + "column": 43 + } + }, + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "audit 'expression_is_true' on model 'customer_totals': Unknown column 'discount' in table 'customer_totals' (context: WHERE)", + "resource_type": "audit", + "resource_name": "expression_is_true", + "path": "models/marts/_sqlbuild/_audits/generic/expression_is_true.sql", + "line": 5, + "column": 21, + "location": { + "path": "models/marts/_sqlbuild/_audits/generic/expression_is_true.sql", + "line": 5, + "column": 21, + "end_line": 6, + "end_column": 5 + } + } + ] + } + ], + "compiled": { + "audits/generic/customer_totals/expression_is_true.sql": [ + "SELECT *", + "FROM __ref(\"customer_totals\")", + "WHERE NOT (discount >= 0)", + "" + ], + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-function-argument-count.json b/tests/goldens/compiler/failure/analysis-function-argument-count.json new file mode 100644 index 0000000000..f4a1354727 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-function-argument-count.json @@ -0,0 +1,273 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B102", + "message": "Invalid arity for function 'SUBSTRING': got 1, expected 2, 3", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 31, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 31, + "end_line": 5, + "end_column": 37 + }, + "help": "pass the number of arguments required by this function's signature" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUBSTRING(status) AS total_amount", + "FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-function-argument-type.json b/tests/goldens/compiler/failure/analysis-function-argument-type.json new file mode 100644 index 0000000000..1e1430c78f --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-function-argument-type.json @@ -0,0 +1,276 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B213", + "message": "Function 'abs' argument 1 expects NUMERIC, found STRING", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 25, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 25, + "end_line": 5, + "end_column": 31 + }, + "help": "supply argument types supported by this function or conditional expression", + "notes": [ + "status is TEXT" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, ABS(status) AS total_amount", + "FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-non-boolean-predicate.json b/tests/goldens/compiler/failure/analysis-non-boolean-predicate.json new file mode 100644 index 0000000000..5f5423e60c --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-non-boolean-predicate.json @@ -0,0 +1,277 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B211", + "message": "WHERE expects a BOOLEAN predicate, found STRING", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 7, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 7, + "end_line": 7, + "end_column": 13 + }, + "help": "use a Boolean predicate in this condition", + "notes": [ + "status is TEXT" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, amount AS total_amount", + "FROM __ref(\"stg_orders\")", + "WHERE status", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-non-constant-limit.json b/tests/goldens/compiler/failure/analysis-non-constant-limit.json new file mode 100644 index 0000000000..6d7372cef6 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-non-constant-limit.json @@ -0,0 +1,274 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B234", + "message": "LIMIT/OFFSET must be a non-negative constant NUMERIC expression", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 7, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 7, + "end_line": 7, + "end_column": 18 + }, + "help": "use a valid constant bound for LIMIT or OFFSET" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id", + "FROM __ref(\"stg_orders\")", + "LIMIT customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-opt-out-conflicts-with-legacy-key.json b/tests/goldens/compiler/failure/analysis-opt-out-conflicts-with-legacy-key.json new file mode 100644 index 0000000000..fe9f4466a9 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-opt-out-conflicts-with-legacy-key.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P003", + "message": "MODEL sql_analysis conflicts with legacy sql_validation" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/analysis-rejected-opt-out-hides-findings.json b/tests/goldens/compiler/failure/analysis-rejected-opt-out-hides-findings.json new file mode 100644 index 0000000000..4f7a31b683 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-rejected-opt-out-hides-findings.json @@ -0,0 +1,275 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P009", + "message": "`sql_analysis false` is not needed for model 'customer_totals'", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 3, + "column": 3, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 3, + "column": 3 + }, + "help": "remove `sql_analysis false` and fix the findings it was hiding: 1 unknown column (run `sqb compile` to see them)\n = help: to allow `sql_analysis false` on any model, SQL test or audit, set this in sqlbuild_project.toml:\n [settings]\n require_sql_analysis = false", + "notes": [ + "sqlbuild_project.toml sets [settings] require_sql_analysis = true, which only allows `sql_analysis false` on SQL that SQLBuild cannot parse; this model parses successfully." + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(refund) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-relationships-unknown-field.json b/tests/goldens/compiler/failure/analysis-relationships-unknown-field.json new file mode 100644 index 0000000000..eea8403898 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-relationships-unknown-field.json @@ -0,0 +1,329 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B300", + "message": "relationships target has no column 'customer_key'", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 4, + "column": 71, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 4, + "column": 71 + }, + "help": "change the metadata column name to an existing output column" + }, + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "audit 'relationships' on model 'customer_totals' column 'customer_id': Unknown column 'customer_key' in table 'stg_orders' (context: SELECT)", + "resource_type": "audit", + "resource_name": "relationships", + "path": "audits/generic/relationships.sql", + "line": 9, + "column": 8, + "location": { + "path": "audits/generic/relationships.sql", + "line": 9, + "column": 8, + "end_line": 9, + "end_column": 20 + } + }, + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "audit 'relationships' on model 'customer_totals' column 'customer_id': Unknown column 'customer_key' in table 'stg_orders' (context: SELECT)", + "resource_type": "audit", + "resource_name": "relationships", + "path": "audits/generic/relationships.sql", + "line": 11, + "column": 27, + "location": { + "path": "audits/generic/relationships.sql", + "line": 11, + "column": 27, + "end_line": 11, + "end_column": 39 + } + } + ] + } + ], + "compiled": { + "audits/generic/customer_totals/relationships__customer_id.sql": [ + "SELECT customer_id", + "FROM __ref(\"customer_totals\")", + "WHERE customer_id IS NOT NULL", + " AND customer_id NOT IN (", + " SELECT customer_key", + " FROM __ref(\"stg_orders\")", + " WHERE customer_key IS NOT NULL", + " )", + "" + ], + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-session-cte-chain-unknown-column.json b/tests/goldens/compiler/failure/analysis-session-cte-chain-unknown-column.json new file mode 100644 index 0000000000..a06ea313c2 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-session-cte-chain-unknown-column.json @@ -0,0 +1,273 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "Unknown column 'order_count' in totals", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 35, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 35, + "end_line": 7, + "end_column": 46 + } + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "WITH base AS (SELECT * FROM __ref(\"stg_orders\")),", + "totals AS (SELECT customer_id, SUM(amount) AS total_amount FROM base GROUP BY 1)", + "SELECT customer_id, total_amount, order_count FROM totals", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-session-enriched-subquery-type-mismatch.json b/tests/goldens/compiler/failure/analysis-session-enriched-subquery-type-mismatch.json new file mode 100644 index 0000000000..346bfa9476 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-session-enriched-subquery-type-mismatch.json @@ -0,0 +1,306 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K002", + "message": "column 'amount' inferred as DOUBLE but declared type is VARCHAR", + "resource_type": "model", + "resource_name": "customer_totals", + "column_name": "amount", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 5, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 5, + "end_line": 6, + "end_column": 11 + }, + "related_locations": [ + { + "label": "output", + "location": { + "path": "models/marts/customer_totals.sql", + "line": 10, + "column": 21, + "end_line": 10, + "end_column": 27 + }, + "message": "inferred DOUBLE" + } + ], + "help": "change the declared type or cast the expression explicitly" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, amount", + "FROM (SELECT * FROM __ref(\"stg_orders\")) staged", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-session-pivot-family-column-mismatch.json b/tests/goldens/compiler/failure/analysis-session-pivot-family-column-mismatch.json new file mode 100644 index 0000000000..c4e0b17259 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-session-pivot-family-column-mismatch.json @@ -0,0 +1,367 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K011", + "message": "model 'status_amounts' dynamic column contract is not proven: dynamic family 'status_amounts' declares pivot_column 'region' but the output pivot uses 'status'", + "resource_type": "model", + "resource_name": "status_amounts", + "path": "models/marts/status_amounts.sql", + "help": "project one supported runtime-dynamic pivot through a wildcard output boundary and declare every generated family" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/marts/status_amounts.sql": [ + "PIVOT __source(\"raw_orders\")", + "ON status", + "USING MAX(amount)", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.status_amounts": { + "database": null, + "schema": "main", + "name": "status_amounts", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/status_amounts.sql", + "original_file_path": "models/marts/status_amounts.sql", + "unique_id": "model.failure_corpus.status_amounts", + "fqn": [ + "failure_corpus", + "models", + "marts", + "status_amounts" + ], + "alias": "status_amounts", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order amounts pivoted by status", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "dynamic_columns": [ + { + "name": "status_amounts", + "pivot_column": "region", + "value_column": "amount", + "aggregate": "MAX", + "type": "DOUBLE", + "name_pattern": null + } + ] + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.status_amounts", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.status_amounts": [ + "source.failure_corpus.raw_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-session-pivot-values-on-clause.json b/tests/goldens/compiler/failure/analysis-session-pivot-values-on-clause.json new file mode 100644 index 0000000000..830a05d90f --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-session-pivot-values-on-clause.json @@ -0,0 +1,367 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K011", + "message": "model 'status_amounts' dynamic column contract is not proven: dynamic column contracts currently require exactly one pivot column", + "resource_type": "model", + "resource_name": "status_amounts", + "path": "models/marts/status_amounts.sql", + "help": "project one supported runtime-dynamic pivot through a wildcard output boundary and declare every generated family" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/marts/status_amounts.sql": [ + "PIVOT __source(\"raw_orders\")", + "ON status IN ('placed')", + "USING MAX(amount)", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.status_amounts": { + "database": null, + "schema": "main", + "name": "status_amounts", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/status_amounts.sql", + "original_file_path": "models/marts/status_amounts.sql", + "unique_id": "model.failure_corpus.status_amounts", + "fqn": [ + "failure_corpus", + "models", + "marts", + "status_amounts" + ], + "alias": "status_amounts", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order amounts pivoted by status", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "dynamic_columns": [ + { + "name": "status_amounts", + "pivot_column": "status", + "value_column": "amount", + "aggregate": "MAX", + "type": "DOUBLE", + "name_pattern": null + } + ] + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.status_amounts", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.status_amounts": [ + "source.failure_corpus.raw_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-session-set-operation-unknown-column.json b/tests/goldens/compiler/failure/analysis-session-set-operation-unknown-column.json new file mode 100644 index 0000000000..3ad0352ce1 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-session-set-operation-unknown-column.json @@ -0,0 +1,276 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "Unknown column 'refund_amount' in stg_orders", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 21, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 21, + "end_line": 7, + "end_column": 34 + }, + "notes": [ + "stg_orders has: amount, status, customer_id, order_id" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, amount AS total_amount FROM __ref(\"stg_orders\")", + "UNION ALL", + "SELECT customer_id, refund_amount FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-session-star-published-unknown-column.json b/tests/goldens/compiler/failure/analysis-session-star-published-unknown-column.json new file mode 100644 index 0000000000..496a2c776b --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-session-star-published-unknown-column.json @@ -0,0 +1,353 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "Unknown column 'missing_amount' in order_layers", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 25, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 25, + "end_line": 5, + "end_column": 39 + }, + "notes": [ + "order_layers has: doubled_amount, amount, status, customer_id, order_id" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(missing_amount) AS total_amount", + "FROM __ref(\"order_layers\")", + "GROUP BY customer_id", + "" + ], + "models/marts/order_layers.sql": [ + "SELECT s.*, s.amount * 2 AS doubled_amount", + "FROM __ref(\"stg_orders\") s", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT *", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.order_layers" + ] + } + }, + "model.failure_corpus.order_layers": { + "database": null, + "schema": "main", + "name": "order_layers", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/order_layers.sql", + "original_file_path": "models/marts/order_layers.sql", + "unique_id": "model.failure_corpus.order_layers", + "fqn": [ + "failure_corpus", + "models", + "marts", + "order_layers" + ], + "alias": "order_layers", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Orders layered over the staged star", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.order_layers", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.order_layers" + ], + "model.failure_corpus.order_layers": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-set-operation-branch-types.json b/tests/goldens/compiler/failure/analysis-set-operation-branch-types.json new file mode 100644 index 0000000000..a4037c2270 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-set-operation-branch-types.json @@ -0,0 +1,272 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B215", + "message": "UNION column 2 has incompatible types: NUMERIC vs DATE", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 1, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 1 + }, + "help": "align the corresponding types in each set-operation branch" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, amount FROM __ref(\"stg_orders\")", + "UNION ALL", + "SELECT customer_id, DATE '2026-01-01' FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-test-fixture-unknown-column.json b/tests/goldens/compiler/failure/analysis-test-fixture-unknown-column.json new file mode 100644 index 0000000000..a984fd998d --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-test-fixture-unknown-column.json @@ -0,0 +1,283 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B302", + "message": "SQL test '__source__raw_orders' names unknown column 'discount'", + "resource_type": "sql_test", + "resource_name": "test_stg_orders", + "path": "tests/unit/test_stg_orders.sql", + "line": 5, + "column": 98, + "location": { + "path": "tests/unit/test_stg_orders.sql", + "line": 5, + "column": 98, + "end_line": 5, + "end_column": 106 + }, + "help": "align the SQL-test fixture or expected columns with the tested resource's output" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ], + "tests/stg_orders/test_stg_orders.sql": [ + "WITH __source__raw_orders AS (SELECT 1 AS order_id, 10 AS customer_id, CAST(5 AS DOUBLE) AS amount, 'placed' AS status, 2 AS discount),", + "__ref__stg_orders AS (SELECT order_id, customer_id, amount, status", + "FROM __source__raw_orders),", + "__actual__stg_orders AS (SELECT * FROM __ref__stg_orders),", + "__expected__stg_orders AS (SELECT 1 AS order_id)", + "SELECT 0 AS step_index, 'stg_orders' AS model_name, (SELECT COUNT(*) FROM __actual__stg_orders) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_orders) AS expected_count, (SELECT COUNT(*) FROM (SELECT order_id FROM __actual__stg_orders EXCEPT SELECT order_id FROM __expected__stg_orders) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT order_id FROM __expected__stg_orders EXCEPT SELECT order_id FROM __actual__stg_orders) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-udf-argument-count.json b/tests/goldens/compiler/failure/analysis-udf-argument-count.json new file mode 100644 index 0000000000..58323fe460 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-udf-argument-count.json @@ -0,0 +1,280 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B102", + "message": "Function 'scaled_amount' expects 2 arguments but received 1", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 28, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 28 + }, + "help": "pass the number of arguments required by this function's signature" + } + ] + } + ], + "compiled": { + "functions/sql/scaled_amount.sql": [ + "CREATE OR REPLACE MACRO main.scaled_amount(p_amount, p_factor) AS (", + "p_amount * p_factor", + ")", + "" + ], + "models/marts/customer_totals.sql": [ + "SELECT customer_id, __udf(\"scaled_amount\")(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.scaled_amount", + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.scaled_amount", + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [], + "model.failure_corpus.scaled_amount": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-udf-argument-family.json b/tests/goldens/compiler/failure/analysis-udf-argument-family.json new file mode 100644 index 0000000000..6bb4f4a102 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-udf-argument-family.json @@ -0,0 +1,280 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B301", + "message": "Function 'scaled_amount' argument 'p_amount' expects DOUBLE, received TEXT; convert the argument explicitly", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 28, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 28 + }, + "help": "align this declared metadata or audit value with the column or argument type" + } + ] + } + ], + "compiled": { + "functions/sql/scaled_amount.sql": [ + "CREATE OR REPLACE MACRO main.scaled_amount(p_amount, p_factor) AS (", + "p_amount * p_factor", + ")", + "" + ], + "models/marts/customer_totals.sql": [ + "SELECT customer_id, __udf(\"scaled_amount\")(status, 2) AS total_amount", + "FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.scaled_amount", + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.scaled_amount", + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [], + "model.failure_corpus.scaled_amount": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-unique-key-unknown-column.json b/tests/goldens/compiler/failure/analysis-unique-key-unknown-column.json new file mode 100644 index 0000000000..ca04c7c838 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-unique-key-unknown-column.json @@ -0,0 +1,274 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B300", + "message": "unique_key references unknown column 'order_key'", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 4, + "column": 15, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 4, + "column": 15 + }, + "help": "change the metadata column name to an existing output column" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "order_key" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-unknown-function.json b/tests/goldens/compiler/failure/analysis-unknown-function.json new file mode 100644 index 0000000000..6f34c1a3a8 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-unknown-function.json @@ -0,0 +1,273 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B101", + "message": "Unknown function 'not_a_function' for dialect DuckDB", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 36, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 36, + "end_line": 5, + "end_column": 42 + }, + "help": "check the function spelling or declare the project function before using it" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, not_a_function(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-unknown-qualifier.json b/tests/goldens/compiler/failure/analysis-unknown-qualifier.json new file mode 100644 index 0000000000..a9ba57f63f --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-unknown-qualifier.json @@ -0,0 +1,273 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B004", + "message": "Unknown table or alias 'x' referenced by column 'order_id'", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 8, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 8, + "end_line": 5, + "end_column": 9 + }, + "help": "give each referenced relation a visible alias in this scope" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT x.order_id", + "FROM __ref(\"stg_orders\") o", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-unsupported-cast.json b/tests/goldens/compiler/failure/analysis-unsupported-cast.json new file mode 100644 index 0000000000..413dbe4691 --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-unsupported-cast.json @@ -0,0 +1,276 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B218", + "message": "Invalid temporal literal", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 21, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 21, + "end_line": 5, + "end_column": 38 + }, + "help": "choose a supported source-to-target cast for this dialect", + "notes": [ + "DATE '2026-13-45' is DATE" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, DATE '2026-13-45' AS placed_on", + "FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/analysis-window-without-over.json b/tests/goldens/compiler/failure/analysis-window-without-over.json new file mode 100644 index 0000000000..b9762e9a4f --- /dev/null +++ b/tests/goldens/compiler/failure/analysis-window-without-over.json @@ -0,0 +1,271 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B232", + "message": "Window function requires an OVER clause", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 1, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 1 + }, + "help": "use this window function with a valid OVER clause and window context" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, ROW_NUMBER() AS position", + "FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/assembly-hook-syntax-unbuilt-dialect.json b/tests/goldens/compiler/failure/assembly-hook-syntax-unbuilt-dialect.json new file mode 100644 index 0000000000..e1bd80236f --- /dev/null +++ b/tests/goldens/compiler/failure/assembly-hook-syntax-unbuilt-dialect.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Polyglot could not parse model 'customer_totals' post_hooks[0] inline_sql(\"...\") (/models/marts/customer_totals.sql): Invalid expression / Unexpected token", + "help": "if this SQL is valid for your warehouse, skip SQL analysis for this model, add this to the MODEL header:\n MODEL (\n sql_analysis false,\n ...\n );\n and please report the SQL so the parser can support it\n = help: SQL analysis is on for this project; to turn it off for every model, set this in sqlbuild_project.toml:\n [settings]\n sql_analysis = false\n = help: to skip SQL analysis for one run, use `--no-sql-analysis`" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/attached-audit-reads-dependant.json b/tests/goldens/compiler/failure/attached-audit-reads-dependant.json new file mode 100644 index 0000000000..e49035df7a --- /dev/null +++ b/tests/goldens/compiler/failure/attached-audit-reads-dependant.json @@ -0,0 +1,271 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P005", + "message": "Audit 'matches_totals' on model 'stg_orders' reads model 'customer_totals', which depends on 'stg_orders'; an attached audit gates its target, so it cannot wait for a resource built from that target", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/_sqlbuild/_audits/generic/matches_totals.sql", + "help": "write a singular audit under audits/singular/ that references both 'stg_orders' and 'customer_totals'; it runs once both are built" + } + ] + } + ], + "compiled": { + "audits/generic/stg_orders/matches_totals.sql": [ + "SELECT *", + "FROM __ref(\"stg_orders\") o", + "WHERE o.customer_id NOT IN (SELECT customer_id FROM __ref(\"customer_totals\"))", + "" + ], + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/audit-parse.json b/tests/goldens/compiler/failure/audit-parse.json new file mode 100644 index 0000000000..2804df5d96 --- /dev/null +++ b/tests/goldens/compiler/failure/audit-parse.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D004", + "message": "AUDIT(...) in '/models/marts/_sqlbuild/audits/singular/broken.sql' contains invalid SQLBuild header syntax: unexpected token 'name' without a value; quote values with spaces" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/audit-role-unsupported-entry.json b/tests/goldens/compiler/failure/audit-role-unsupported-entry.json new file mode 100644 index 0000000000..9d174e5294 --- /dev/null +++ b/tests/goldens/compiler/failure/audit-role-unsupported-entry.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "Unsupported entries in audits/: audits/at_least.sql; audit files must live in audits/generic/ or audits/singular/" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/audit-unknown-project-variable.json b/tests/goldens/compiler/failure/audit-unknown-project-variable.json new file mode 100644 index 0000000000..3525ad0f6b --- /dev/null +++ b/tests/goldens/compiler/failure/audit-unknown-project-variable.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "unknown project variable '@@floor_amount' in '/models/staging/_sqlbuild/_audits/generic/floor.sql'. Available vars: region" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/audit-variable-in-doubled-backticks.json b/tests/goldens/compiler/failure/audit-variable-in-doubled-backticks.json new file mode 100644 index 0000000000..3525ad0f6b --- /dev/null +++ b/tests/goldens/compiler/failure/audit-variable-in-doubled-backticks.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "unknown project variable '@@floor_amount' in '/models/staging/_sqlbuild/_audits/generic/floor.sql'. Available vars: region" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/built-in-audit-shadow.json b/tests/goldens/compiler/failure/built-in-audit-shadow.json new file mode 100644 index 0000000000..eda200b8ff --- /dev/null +++ b/tests/goldens/compiler/failure/built-in-audit-shadow.json @@ -0,0 +1,279 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "warning", + "code": "P003", + "message": "project audit 'not_null' overrides built-in audit 'not_null'", + "path": "models/staging/_sqlbuild/_audits/generic/not_null.sql", + "help": "rename the project audit if this override is unintended" + }, + { + "phase": "compile", + "severity": "error", + "code": "S010", + "message": "Unused local declaration 'audit:not_null' at models/staging/_sqlbuild/_audits/generic/not_null.sql; remove it or add a genuine runtime use", + "resource_type": "audit", + "resource_name": "not_null", + "path": "models/staging/_sqlbuild/_audits/generic/not_null.sql", + "line": 1, + "column": 1, + "location": { + "path": "models/staging/_sqlbuild/_audits/generic/not_null.sql", + "line": 1, + "column": 1 + } + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/check-depends-on-check.json b/tests/goldens/compiler/failure/check-depends-on-check.json new file mode 100644 index 0000000000..79039c3ed2 --- /dev/null +++ b/tests/goldens/compiler/failure/check-depends-on-check.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D007", + "message": "Check 'orders_checked' depends on another check; checks may depend on loaders, tasks, assets, models, sources, and seeds only" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/column-nullable-not-null.json b/tests/goldens/compiler/failure/column-nullable-not-null.json new file mode 100644 index 0000000000..967e247e56 --- /dev/null +++ b/tests/goldens/compiler/failure/column-nullable-not-null.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P002", + "message": "models/staging/stg_orders.sql column 'order_id' cannot set nullable = true and audit not_null", + "help": "remove the not_null audit or set nullable = false" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/command-output-sink-unknown-provider.json b/tests/goldens/compiler/failure/command-output-sink-unknown-provider.json new file mode 100644 index 0000000000..9fb21e36bd --- /dev/null +++ b/tests/goldens/compiler/failure/command-output-sink-unknown-provider.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D015", + "message": "Command-output sink 'publish_output' in sinks/output.py requires unknown provider 'destination_client'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/commented-ref-argument.json b/tests/goldens/compiler/failure/commented-ref-argument.json new file mode 100644 index 0000000000..c4d7ff89d0 --- /dev/null +++ b/tests/goldens/compiler/failure/commented-ref-argument.json @@ -0,0 +1,270 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__ref( /* upstream */ 'stg_orders') is not a valid __ref() call", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 41 + }, + "help": "__ref() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __ref(\"stg_orders\")" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref( /* upstream */ 'stg_orders')", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/comparison-type.json b/tests/goldens/compiler/failure/comparison-type.json new file mode 100644 index 0000000000..51fbf222ca --- /dev/null +++ b/tests/goldens/compiler/failure/comparison-type.json @@ -0,0 +1,278 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B217", + "message": "Incompatible comparison between NUMERIC and DATE", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 7, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 7, + "end_line": 7, + "end_column": 33 + }, + "help": "compare with a date, for example DATE '2026-04-01'", + "notes": [ + "amount is DOUBLE, DATE '2026-01-01' is DATE" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "WHERE amount = DATE '2026-01-01'", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/config-bom.json b/tests/goldens/compiler/failure/config-bom.json new file mode 100644 index 0000000000..e2af44d5b4 --- /dev/null +++ b/tests/goldens/compiler/failure/config-bom.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D001", + "message": "/sqlbuild_project.toml contains invalid TOML: Invalid statement (at line 1, column 1)" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-concurrency-without-capability.json b/tests/goldens/compiler/failure/config-concurrency-without-capability.json new file mode 100644 index 0000000000..72b28b51ed --- /dev/null +++ b/tests/goldens/compiler/failure/config-concurrency-without-capability.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': batch_concurrency > 1 requires incremental_mode=microbatch" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-cursor-bound-outside-utc-years.json b/tests/goldens/compiler/failure/config-cursor-bound-outside-utc-years.json new file mode 100644 index 0000000000..b933cf121d --- /dev/null +++ b/tests/goldens/compiler/failure/config-cursor-bound-outside-utc-years.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': cursor_start value '0001-01-01T00:00:00+01:00' falls outside years 1-9999 once converted to UTC", + "help": "keep cursor_start within years 1-9999 in UTC, add this to the MODEL header:\n MODEL (\n cursor_start '0001-01-01T00:00:00+00:00',\n ...\n );" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-cursor-bounds-reversed.json b/tests/goldens/compiler/failure/config-cursor-bounds-reversed.json new file mode 100644 index 0000000000..219673ce50 --- /dev/null +++ b/tests/goldens/compiler/failure/config-cursor-bounds-reversed.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': cursor_start must be before exclusive cursor_end" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-equally-specific-path-defaults.json b/tests/goldens/compiler/failure/config-equally-specific-path-defaults.json new file mode 100644 index 0000000000..3055d01eee --- /dev/null +++ b/tests/goldens/compiler/failure/config-equally-specific-path-defaults.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D007", + "message": "Model path 'staging/stg_orders.sql' matches equally specific path_defaults keys: '*/stg_orders.sql', 'staging/*'.", + "help": "Make one pattern narrower by adding literal or '*' path segments, or remove the overlap. Path-default selection never depends on declaration order." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-header-tags-not-list.json b/tests/goldens/compiler/failure/config-header-tags-not-list.json new file mode 100644 index 0000000000..e5bf494b08 --- /dev/null +++ b/tests/goldens/compiler/failure/config-header-tags-not-list.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders' tags must be a list" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-incremental-key-on-table.json b/tests/goldens/compiler/failure/config-incremental-key-on-table.json new file mode 100644 index 0000000000..27e5f2e87a --- /dev/null +++ b/tests/goldens/compiler/failure/config-incremental-key-on-table.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': on_schema_change is only valid for incremental models" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-incremental-without-strategy.json b/tests/goldens/compiler/failure/config-incremental-without-strategy.json new file mode 100644 index 0000000000..4e834f3909 --- /dev/null +++ b/tests/goldens/compiler/failure/config-incremental-without-strategy.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': incremental materialization requires incremental_strategy" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-macro-outside-hooks.json b/tests/goldens/compiler/failure/config-macro-outside-hooks.json new file mode 100644 index 0000000000..469e811060 --- /dev/null +++ b/tests/goldens/compiler/failure/config-macro-outside-hooks.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model config field 'alias' does not allow macros" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-merge-exclusion-overlaps-key.json b/tests/goldens/compiler/failure/config-merge-exclusion-overlaps-key.json new file mode 100644 index 0000000000..0ce60aa3f5 --- /dev/null +++ b/tests/goldens/compiler/failure/config-merge-exclusion-overlaps-key.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': merge_exclude_columns cannot include unique_key column(s): ORDER_ID" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-microbatch-without-strategy.json b/tests/goldens/compiler/failure/config-microbatch-without-strategy.json new file mode 100644 index 0000000000..bad4f2e413 --- /dev/null +++ b/tests/goldens/compiler/failure/config-microbatch-without-strategy.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': incremental_mode=microbatch requires explicit microbatch_strategy (rolling_window or watermark)" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-migrate-force-on-table.json b/tests/goldens/compiler/failure/config-migrate-force-on-table.json new file mode 100644 index 0000000000..f8d07ab2cc --- /dev/null +++ b/tests/goldens/compiler/failure/config-migrate-force-on-table.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': migrate_force is only valid for incremental and snapshot models; nothing is replaced when a 'table' model migrates, because tables and views are rebuilt under their new name", + "help": "remove migrate_force from the model header" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-old-name-view-without-duration.json b/tests/goldens/compiler/failure/config-old-name-view-without-duration.json new file mode 100644 index 0000000000..53627ed2b4 --- /dev/null +++ b/tests/goldens/compiler/failure/config-old-name-view-without-duration.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': old_name_view must be a positive duration such as 7d, or false; got 'soon'", + "help": "write for example old_name_view 7d, or old_name_view false" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-placeholder-on-built-in-materialization.json b/tests/goldens/compiler/failure/config-placeholder-on-built-in-materialization.json new file mode 100644 index 0000000000..8158924744 --- /dev/null +++ b/tests/goldens/compiler/failure/config-placeholder-on-built-in-materialization.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': @@@placeholders are only allowed on custom materializations" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-retention-not-whole-days.json b/tests/goldens/compiler/failure/config-retention-not-whole-days.json new file mode 100644 index 0000000000..4440debbaf --- /dev/null +++ b/tests/goldens/compiler/failure/config-retention-not-whole-days.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': time_travel_retention must be a whole-day string like '7d', 'inherit', or 'disabled'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-retention-on-view.json b/tests/goldens/compiler/failure/config-retention-on-view.json new file mode 100644 index 0000000000..b9daf2ab2a --- /dev/null +++ b/tests/goldens/compiler/failure/config-retention-on-view.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': managed time_travel_retention is not valid for views; set time_travel_retention disabled" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-several-faults-reports-the-first.json b/tests/goldens/compiler/failure/config-several-faults-reports-the-first.json new file mode 100644 index 0000000000..477aa05f9c --- /dev/null +++ b/tests/goldens/compiler/failure/config-several-faults-reports-the-first.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': table_type must be permanent, transient, or inherit" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-snapshot-without-unique-key.json b/tests/goldens/compiler/failure/config-snapshot-without-unique-key.json new file mode 100644 index 0000000000..431a0ffca7 --- /dev/null +++ b/tests/goldens/compiler/failure/config-snapshot-without-unique-key.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': snapshot materialization requires unique_key" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-template-missing-environment-variable.json b/tests/goldens/compiler/failure/config-template-missing-environment-variable.json new file mode 100644 index 0000000000..12032faac2 --- /dev/null +++ b/tests/goldens/compiler/failure/config-template-missing-environment-variable.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model config references missing ENV variable 'SQB_CORPUS_UNSET_SCHEMA'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-template-unknown-namespace.json b/tests/goldens/compiler/failure/config-template-unknown-namespace.json new file mode 100644 index 0000000000..2700f29bcd --- /dev/null +++ b/tests/goldens/compiler/failure/config-template-unknown-namespace.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model config references unsupported template namespace 'VAULT'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-template-unknown-variable.json b/tests/goldens/compiler/failure/config-template-unknown-variable.json new file mode 100644 index 0000000000..72753ad8c6 --- /dev/null +++ b/tests/goldens/compiler/failure/config-template-unknown-variable.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model config references unknown variable 'missing_region'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-template-unsupported-function.json b/tests/goldens/compiler/failure/config-template-unsupported-function.json new file mode 100644 index 0000000000..598de35743 --- /dev/null +++ b/tests/goldens/compiler/failure/config-template-unsupported-function.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model config references unsupported template function 'upper'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-template-unterminated-string.json b/tests/goldens/compiler/failure/config-template-unterminated-string.json new file mode 100644 index 0000000000..928b630a46 --- /dev/null +++ b/tests/goldens/compiler/failure/config-template-unterminated-string.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "template expression has unterminated single-quoted string at position 9" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-template-wrong-argument-count.json b/tests/goldens/compiler/failure/config-template-wrong-argument-count.json new file mode 100644 index 0000000000..7987f0aa98 --- /dev/null +++ b/tests/goldens/compiler/failure/config-template-wrong-argument-count.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model config if(...) expects 3 arguments" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-toml-syntax.json b/tests/goldens/compiler/failure/config-toml-syntax.json new file mode 100644 index 0000000000..3b8eaedf30 --- /dev/null +++ b/tests/goldens/compiler/failure/config-toml-syntax.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D001", + "message": "/sqlbuild_project.toml contains invalid TOML: Expected ']' at the end of a table declaration (at line 6, column 10)" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-unknown-adapter.json b/tests/goldens/compiler/failure/config-unknown-adapter.json new file mode 100644 index 0000000000..cb53fda78f --- /dev/null +++ b/tests/goldens/compiler/failure/config-unknown-adapter.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "C601", + "message": "unknown adapter 'warehouse9000'. Available built-in adapters: bigquery, databricks, duckdb, motherduck, postgres, snowflake, sqlserver. Project-local adapters are discovered from adapters/**/*.py." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-unknown-contract.json b/tests/goldens/compiler/failure/config-unknown-contract.json new file mode 100644 index 0000000000..c92b833472 --- /dev/null +++ b/tests/goldens/compiler/failure/config-unknown-contract.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': unknown contract 'strict'; valid values: enforced, none" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-unknown-default-key.json b/tests/goldens/compiler/failure/config-unknown-default-key.json new file mode 100644 index 0000000000..171f6252b1 --- /dev/null +++ b/tests/goldens/compiler/failure/config-unknown-default-key.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D001", + "message": "/sqlbuild_project.toml [defaults] contains unknown key(s): description. Allowed keys: append_cursor_inclusive, batch_concurrency, batch_size, contract, cursor_end, cursor_future_action, cursor_future_max_distance, cursor_start, cursor_start_max_action, cursor_start_max_ahead, cursor_watermark_mode, database, full_refresh, function_database, function_schema, incremental_mode, incremental_strategy, lookback, materialized, max_microbatches, merge_exclude_columns, microbatch_strategy, replay_on_change, row_diff_exclude_columns, row_diff_sample_rows, row_diff_sample_seed, row_diff_tolerances, schema, seed_database, seed_schema, tags, unaccounted_partition_policy", + "help": "remove the key; see the reference for supported keys" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-unknown-materialization.json b/tests/goldens/compiler/failure/config-unknown-materialization.json new file mode 100644 index 0000000000..bb367cc1c7 --- /dev/null +++ b/tests/goldens/compiler/failure/config-unknown-materialization.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': unknown materialization 'archive'; not a built-in type and no custom materialization with that name was discovered" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-unknown-model-reference.json b/tests/goldens/compiler/failure/config-unknown-model-reference.json new file mode 100644 index 0000000000..e30c3b4ce0 --- /dev/null +++ b/tests/goldens/compiler/failure/config-unknown-model-reference.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Model file models/marts/customer_totals.sql references unknown model 'stg_refunds'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-unknown-table-type.json b/tests/goldens/compiler/failure/config-unknown-table-type.json new file mode 100644 index 0000000000..477aa05f9c --- /dev/null +++ b/tests/goldens/compiler/failure/config-unknown-table-type.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': table_type must be permanent, transient, or inherit" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-untyped-hook-entry.json b/tests/goldens/compiler/failure/config-untyped-hook-entry.json new file mode 100644 index 0000000000..9a008b6060 --- /dev/null +++ b/tests/goldens/compiler/failure/config-untyped-hook-entry.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders' pre_hooks entries must use typed inline_sql(...), sql(...), or python(...) hook syntax" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/config-watermark-limit-below-lookback.json b/tests/goldens/compiler/failure/config-watermark-limit-below-lookback.json new file mode 100644 index 0000000000..3964c7d569 --- /dev/null +++ b/tests/goldens/compiler/failure/config-watermark-limit-below-lookback.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': max_microbatches 2 is below the ordinary lookback requirement of 4 batches" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/constant-header-nested-too-deep.json b/tests/goldens/compiler/failure/constant-header-nested-too-deep.json new file mode 100644 index 0000000000..766c4e1b73 --- /dev/null +++ b/tests/goldens/compiler/failure/constant-header-nested-too-deep.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "CONSTANT(...) in '/models/staging/_sqlbuild/_constants/statuses.sql:1' contains invalid SQLBuild header syntax: values nest deeper than 256 levels", + "help": "flatten the value so it nests at most 256 levels deep" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/context-variable-in-model-sql.json b/tests/goldens/compiler/failure/context-variable-in-model-sql.json new file mode 100644 index 0000000000..7f1b08f4cf --- /dev/null +++ b/tests/goldens/compiler/failure/context-variable-in-model-sql.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL text in '/models/staging/stg_orders.sql' does not allow @@CTX templates" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/contract-dynamic-columns-unproven.json b/tests/goldens/compiler/failure/contract-dynamic-columns-unproven.json new file mode 100644 index 0000000000..fc9632ced7 --- /dev/null +++ b/tests/goldens/compiler/failure/contract-dynamic-columns-unproven.json @@ -0,0 +1,289 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K011", + "message": "model 'customer_totals' dynamic column contract is not proven: dynamic pivot input does not have an authoritative, explicit schema", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "help": "project one supported runtime-dynamic pivot through a wildcard output boundary and declare every generated family" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "PIVOT __ref(\"stg_orders\")", + "ON status", + "USING MAX(amount)", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "dynamic_columns": [ + { + "name": "status_amounts", + "pivot_column": "status", + "value_column": "amount", + "aggregate": "MAX", + "type": "DOUBLE", + "name_pattern": null + } + ] + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-dynamic-columns-unsupported-dialect.json b/tests/goldens/compiler/failure/contract-dynamic-columns-unsupported-dialect.json new file mode 100644 index 0000000000..2d8a604087 --- /dev/null +++ b/tests/goldens/compiler/failure/contract-dynamic-columns-unsupported-dialect.json @@ -0,0 +1,288 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K011", + "message": "model 'customer_totals' dynamic column contract is not proven: adapter dialect 'postgresql' does not support compiler-proven dynamic pivots", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "help": "project one supported runtime-dynamic pivot through a wildcard output boundary and declare every generated family" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, MAX(amount) AS placed", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "public", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "dynamic_columns": [ + { + "name": "status_amounts", + "pivot_column": "status", + "value_column": "amount", + "aggregate": "MAX", + "type": "DOUBLE", + "name_pattern": null + } + ] + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "public.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "public", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "public.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-dynamic-family-type-mismatch.json b/tests/goldens/compiler/failure/contract-dynamic-family-type-mismatch.json new file mode 100644 index 0000000000..fda60c4471 --- /dev/null +++ b/tests/goldens/compiler/failure/contract-dynamic-family-type-mismatch.json @@ -0,0 +1,328 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K002", + "message": "dynamic column family 'status_amounts' inferred as DOUBLE but declared type is VARCHAR", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "help": "correct the family type or the pivot aggregate input type" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "PIVOT __ref(\"stg_orders\")", + "ON status", + "USING MAX(amount)", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT CAST(order_id AS INTEGER) AS order_id,", + " CAST(customer_id AS INTEGER) AS customer_id,", + " CAST(amount AS DOUBLE) AS amount, CAST(status AS VARCHAR) AS status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order amounts per status", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "dynamic_columns": [ + { + "name": "status_amounts", + "pivot_column": "status", + "value_column": "amount", + "aggregate": "MAX", + "type": "VARCHAR", + "name_pattern": null + } + ] + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-errors-across-models.json b/tests/goldens/compiler/failure/contract-errors-across-models.json new file mode 100644 index 0000000000..76a591bf7f --- /dev/null +++ b/tests/goldens/compiler/failure/contract-errors-across-models.json @@ -0,0 +1,380 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K002", + "message": "column 'total_amount' inferred as DOUBLE but declared type is BIGINT", + "resource_type": "model", + "resource_name": "typed_totals", + "column_name": "total_amount", + "path": "models/marts/typed_totals.sql", + "line": 3, + "column": 12, + "location": { + "path": "models/marts/typed_totals.sql", + "line": 3, + "column": 12, + "end_line": 3, + "end_column": 24 + }, + "related_locations": [ + { + "label": "output", + "location": { + "path": "models/marts/typed_totals.sql", + "line": 6, + "column": 8, + "end_line": 6, + "end_column": 43 + }, + "message": "inferred DOUBLE" + } + ], + "help": "change the declared type or cast the expression explicitly" + }, + { + "phase": "contract", + "severity": "error", + "code": "K006", + "message": "model 'stg_orders' has contract enforced but declares no columns", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "help": "add MODEL(columns (...)), declare a proven MODEL(dynamic_columns (...)) family, or set contract none for this model" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, CAST(SUM(amount) AS VARCHAR) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/marts/typed_totals.sql": [ + "SELECT CAST(1.5 AS DOUBLE) AS total_amount", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.typed_totals": { + "database": null, + "schema": "main", + "name": "typed_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/typed_totals.sql", + "original_file_path": "models/marts/typed_totals.sql", + "unique_id": "model.failure_corpus.typed_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "typed_totals" + ], + "alias": "typed_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Typed totals", + "columns": { + "total_amount": { + "name": "total_amount", + "description": "", + "meta": {}, + "data_type": "BIGINT", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.typed_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.typed_totals": [], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-extra-column.json b/tests/goldens/compiler/failure/contract-extra-column.json new file mode 100644 index 0000000000..b67d98b5f4 --- /dev/null +++ b/tests/goldens/compiler/failure/contract-extra-column.json @@ -0,0 +1,303 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K005", + "message": "column 'status' is not declared in enforced contract for model 'stg_orders'", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "status", + "path": "models/staging/stg_orders.sql", + "line": 11, + "column": 39, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 11, + "column": 39, + "end_line": 11, + "end_column": 45 + }, + "help": "add the column to MODEL(columns) or remove it from the SELECT list" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-immediate-promotion-several-models.json b/tests/goldens/compiler/failure/contract-immediate-promotion-several-models.json new file mode 100644 index 0000000000..c6fab88b86 --- /dev/null +++ b/tests/goldens/compiler/failure/contract-immediate-promotion-several-models.json @@ -0,0 +1,321 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K011", + "message": "model 'customer_totals': contract enforced requires staged table promotion; immediate table promotion cannot validate runtime output before target mutation", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "help": "sqlbuild_project.toml sets [settings] table_promotion_mode = \"immediate\"; enforced contracts are validated in a staging table before promotion\n = help: remove that line to use the default staged promotion, or set this in sqlbuild_project.toml:\n [settings]\n table_promotion_mode = \"staged\"\n = help: or remove the model's enforced contract: `contract enforced` in its MODEL header, or `contract = \"enforced\"` in the [defaults] or [path_defaults] entry that applies to it" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "total_amount": { + "name": "total_amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-immediate-promotion.json b/tests/goldens/compiler/failure/contract-immediate-promotion.json new file mode 100644 index 0000000000..e6761a433d --- /dev/null +++ b/tests/goldens/compiler/failure/contract-immediate-promotion.json @@ -0,0 +1,302 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K011", + "message": "model 'stg_orders': contract enforced requires staged table promotion; immediate table promotion cannot validate runtime output before target mutation", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "help": "sqlbuild_project.toml sets [settings] table_promotion_mode = \"immediate\"; enforced contracts are validated in a staging table before promotion\n = help: remove that line to use the default staged promotion, or set this in sqlbuild_project.toml:\n [settings]\n table_promotion_mode = \"staged\"\n = help: or remove the model's enforced contract: `contract enforced` in its MODEL header, or `contract = \"enforced\"` in the [defaults] or [path_defaults] entry that applies to it" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-implicit-missing-column.json b/tests/goldens/compiler/failure/contract-implicit-missing-column.json new file mode 100644 index 0000000000..87a901d28f --- /dev/null +++ b/tests/goldens/compiler/failure/contract-implicit-missing-column.json @@ -0,0 +1,303 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K001", + "message": "declared column 'order_count' was not found in statically inferred output for model 'customer_totals'", + "resource_type": "model", + "resource_name": "customer_totals", + "column_name": "order_count", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 5, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 5, + "end_line": 6, + "end_column": 16 + }, + "help": "add order_count to the SELECT list or correct/remove MODEL(columns (...)); MODEL(columns (...)) is validated using static SQL analysis because settings.column_contract_mode is \"implicit\" (the default). If this project intentionally uses columns only for metadata and audits, set [settings] column_contract_mode = \"explicit\"; models with contract enforced remain validated" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "total_amount": { + "name": "total_amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "order_count": { + "name": "order_count", + "description": "", + "meta": {}, + "data_type": "BIGINT", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-local-immediate-promotion.json b/tests/goldens/compiler/failure/contract-local-immediate-promotion.json new file mode 100644 index 0000000000..ffbc3c59c3 --- /dev/null +++ b/tests/goldens/compiler/failure/contract-local-immediate-promotion.json @@ -0,0 +1,302 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K011", + "message": "model 'stg_orders': contract enforced requires staged table promotion; immediate table promotion cannot validate runtime output before target mutation", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "help": "sqlbuild_local.toml sets [settings] table_promotion_mode = \"immediate\"; enforced contracts are validated in a staging table before promotion\n = help: remove that line to use the default staged promotion, or set this in sqlbuild_local.toml:\n [settings]\n table_promotion_mode = \"staged\"\n = help: or remove the model's enforced contract: `contract enforced` in its MODEL header, or `contract = \"enforced\"` in the [defaults] or [path_defaults] entry that applies to it" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-missing-column.json b/tests/goldens/compiler/failure/contract-missing-column.json new file mode 100644 index 0000000000..4569eb6cb6 --- /dev/null +++ b/tests/goldens/compiler/failure/contract-missing-column.json @@ -0,0 +1,321 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K001", + "message": "enforced contract column 'discount' was not found in statically inferred output for model 'stg_orders'", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "discount", + "path": "models/staging/stg_orders.sql", + "line": 9, + "column": 5, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 9, + "column": 5, + "end_line": 9, + "end_column": 13 + }, + "help": "add discount to the SELECT list or correct MODEL(columns (...)); validation is active because this model declares contract enforced" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "discount": { + "name": "discount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-named-schema-columns.json b/tests/goldens/compiler/failure/contract-named-schema-columns.json new file mode 100644 index 0000000000..6c70207613 --- /dev/null +++ b/tests/goldens/compiler/failure/contract-named-schema-columns.json @@ -0,0 +1,332 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K005", + "message": "column 'status' is not declared in enforced contract for model 'stg_orders'", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "status", + "path": "models/staging/stg_orders.sql", + "line": 7, + "column": 39, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 7, + "column": 39, + "end_line": 7, + "end_column": 45 + }, + "help": "add the column to the named SCHEMA or remove it from the SELECT list" + }, + { + "phase": "contract", + "severity": "error", + "code": "K001", + "message": "enforced contract column 'shipped_at' was not found in statically inferred output for model 'stg_orders'", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "shipped_at", + "path": "models/staging/_sqlbuild/_schemas/staged_order.sql", + "line": 8, + "column": 5, + "location": { + "path": "models/staging/_sqlbuild/_schemas/staged_order.sql", + "line": 8, + "column": 5, + "end_line": 8, + "end_column": 15 + }, + "help": "add shipped_at to the SELECT list or correct the named SCHEMA declaration; validation is active because this model declares contract enforced" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "shipped_at": { + "name": "shipped_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-nullability.json b/tests/goldens/compiler/failure/contract-nullability.json new file mode 100644 index 0000000000..b76fd7bb4e --- /dev/null +++ b/tests/goldens/compiler/failure/contract-nullability.json @@ -0,0 +1,325 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K004", + "message": "column 'customer_id' is declared non-null but may be nullable", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "customer_id", + "path": "models/staging/stg_orders.sql", + "line": 6, + "column": 5, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 6, + "column": 5, + "end_line": 6, + "end_column": 16 + }, + "related_locations": [ + { + "label": "output", + "location": { + "path": "models/staging/stg_orders.sql", + "line": 12, + "column": 18, + "end_line": 12, + "end_column": 54 + }, + "message": "output expression proven nullable" + } + ], + "help": "use COALESCE, filter nulls explicitly, or remove the non-null contract" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, CAST(NULL AS INTEGER) AS customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-order-every-column-family.json b/tests/goldens/compiler/failure/contract-order-every-column-family.json new file mode 100644 index 0000000000..8726fb269d --- /dev/null +++ b/tests/goldens/compiler/failure/contract-order-every-column-family.json @@ -0,0 +1,398 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K005", + "message": "column 'status' is not declared in enforced contract for model 'stg_orders'", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "status", + "path": "models/staging/stg_orders.sql", + "line": 12, + "column": 64, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 12, + "column": 64, + "end_line": 12, + "end_column": 70 + }, + "help": "add the column to MODEL(columns) or remove it from the SELECT list" + }, + { + "phase": "contract", + "severity": "error", + "code": "K002", + "message": "column 'order_id' inferred as INTEGER but declared type is VARCHAR", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "order_id", + "path": "models/staging/stg_orders.sql", + "line": 5, + "column": 5, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 5, + "column": 5, + "end_line": 5, + "end_column": 13 + }, + "related_locations": [ + { + "label": "output", + "location": { + "path": "models/staging/stg_orders.sql", + "line": 12, + "column": 8, + "end_line": 12, + "end_column": 16 + }, + "message": "inferred INTEGER" + } + ], + "help": "change the declared type or cast the expression explicitly" + }, + { + "phase": "contract", + "severity": "error", + "code": "K004", + "message": "column 'customer_id' is declared non-null but may be nullable", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "customer_id", + "path": "models/staging/stg_orders.sql", + "line": 6, + "column": 5, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 6, + "column": 5, + "end_line": 6, + "end_column": 16 + }, + "related_locations": [ + { + "label": "output", + "location": { + "path": "models/staging/stg_orders.sql", + "line": 12, + "column": 18, + "end_line": 12, + "end_column": 54 + }, + "message": "output expression proven nullable" + } + ], + "help": "use COALESCE, filter nulls explicitly, or remove the non-null contract" + }, + { + "phase": "contract", + "severity": "error", + "code": "K001", + "message": "enforced contract column 'shipped_at' was not found in statically inferred output for model 'stg_orders'", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "shipped_at", + "path": "models/staging/stg_orders.sql", + "line": 7, + "column": 5, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 7, + "column": 5, + "end_line": 7, + "end_column": 15 + }, + "help": "add shipped_at to the SELECT list or correct MODEL(columns (...)); validation is active because this model declares contract enforced" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, CAST(NULL AS INTEGER) AS customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "shipped_at": { + "name": "shipped_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-type-mismatch.json b/tests/goldens/compiler/failure/contract-type-mismatch.json new file mode 100644 index 0000000000..b02987306e --- /dev/null +++ b/tests/goldens/compiler/failure/contract-type-mismatch.json @@ -0,0 +1,325 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K002", + "message": "column 'order_id' inferred as INTEGER but declared type is VARCHAR", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "order_id", + "path": "models/staging/stg_orders.sql", + "line": 5, + "column": 5, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 5, + "column": 5, + "end_line": 5, + "end_column": 13 + }, + "related_locations": [ + { + "label": "output", + "location": { + "path": "models/staging/stg_orders.sql", + "line": 12, + "column": 8, + "end_line": 12, + "end_column": 16 + }, + "message": "inferred INTEGER" + } + ], + "help": "change the declared type or cast the expression explicitly" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-unknown-type.json b/tests/goldens/compiler/failure/contract-unknown-type.json new file mode 100644 index 0000000000..c0d4f7a6f1 --- /dev/null +++ b/tests/goldens/compiler/failure/contract-unknown-type.json @@ -0,0 +1,298 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K002", + "message": "column 'order_id' inferred as INTEGER but declared type is MYSTERY_TYPE", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "order_id", + "path": "models/staging/stg_orders.sql", + "line": 4, + "column": 5, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 4, + "column": 5, + "end_line": 4, + "end_column": 13 + }, + "related_locations": [ + { + "label": "output", + "location": { + "path": "models/staging/stg_orders.sql", + "line": 8, + "column": 8, + "end_line": 8, + "end_column": 16 + }, + "message": "inferred INTEGER" + } + ], + "help": "change the declared type or cast the expression explicitly" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "MYSTERY_TYPE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/contract-without-columns.json b/tests/goldens/compiler/failure/contract-without-columns.json new file mode 100644 index 0000000000..480749a518 --- /dev/null +++ b/tests/goldens/compiler/failure/contract-without-columns.json @@ -0,0 +1,265 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K006", + "message": "model 'stg_orders' has contract enforced but declares no columns", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "help": "add MODEL(columns (...)), declare a proven MODEL(dynamic_columns (...)) family, or set contract none for this model" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/cursor-intrinsic-outside-incremental.json b/tests/goldens/compiler/failure/cursor-intrinsic-outside-incremental.json new file mode 100644 index 0000000000..38b924499f --- /dev/null +++ b/tests/goldens/compiler/failure/cursor-intrinsic-outside-incremental.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Model 'stg_orders' uses cursor intrinsics but is not a built-in incremental model" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/cursor-model-without-inputs.json b/tests/goldens/compiler/failure/cursor-model-without-inputs.json new file mode 100644 index 0000000000..8fed1f1c08 --- /dev/null +++ b/tests/goldens/compiler/failure/cursor-model-without-inputs.json @@ -0,0 +1,268 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P011", + "message": "incremental model 'customer_totals' reads no inputs, so builds after the first cannot work out their cursor window", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 3, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 3, + "end_line": 5, + "end_column": 19 + }, + "help": "read the data through __ref(), __source() or __seed() so its cursor can bound the window, or use materialized table if the model has no upstream data" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT TIMESTAMP '2026-01-01 00:00:00' AS placed_at, 1 AS customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/cursor-unknown-column.json b/tests/goldens/compiler/failure/cursor-unknown-column.json new file mode 100644 index 0000000000..f614aa5ce4 --- /dev/null +++ b/tests/goldens/compiler/failure/cursor-unknown-column.json @@ -0,0 +1,272 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B300", + "message": "cursor references unknown column 'placed_at'", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 10, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 10 + }, + "help": "change the metadata column name to an existing output column" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/dbt-reference-without-manifest.json b/tests/goldens/compiler/failure/dbt-reference-without-manifest.json new file mode 100644 index 0000000000..6f3b715373 --- /dev/null +++ b/tests/goldens/compiler/failure/dbt-reference-without-manifest.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "C214", + "message": "Model file models/marts/customer_totals.sql uses __dbt_ref(\"upstream_orders\") but no dbt manifest was found", + "help": "Run dbt compile or configure dbt target_path so SQLBuild can read manifest.json." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/dbt-unknown-key.json b/tests/goldens/compiler/failure/dbt-unknown-key.json new file mode 100644 index 0000000000..349baa71af --- /dev/null +++ b/tests/goldens/compiler/failure/dbt-unknown-key.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D001", + "message": "/sqlbuild_project.toml dbt contains unknown key(s): manifest. Allowed keys: profiles_dir, project_dir, target, target_path, vars", + "help": "supported keys: profiles_dir, project_dir, target, target_path, vars" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/declaration-first-of-two-reference-errors.json b/tests/goldens/compiler/failure/declaration-first-of-two-reference-errors.json new file mode 100644 index 0000000000..a2c4b904e1 --- /dev/null +++ b/tests/goldens/compiler/failure/declaration-first-of-two-reference-errors.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Unknown member 'HELD' for enum 'staged_status' in '/models/staging/stg_orders.sql'. Available members: PLACED" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/declaration-group-below-root.json b/tests/goldens/compiler/failure/declaration-group-below-root.json new file mode 100644 index 0000000000..ebbb8b534f --- /dev/null +++ b/tests/goldens/compiler/failure/declaration-group-below-root.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "Grouped declaration root models/_sqlbuild/ must be below a concrete owner directory; use the project-wide macros/, enums/, constants/, audits/, schemas/, or hooks/ root instead" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/declaration-group-unsupported-entry.json b/tests/goldens/compiler/failure/declaration-group-unsupported-entry.json new file mode 100644 index 0000000000..71f4684d71 --- /dev/null +++ b/tests/goldens/compiler/failure/declaration-group-unsupported-entry.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "Declaration group models/marts/_sqlbuild/ contains unsupported entries: models/marts/_sqlbuild/notes.txt" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/declaration-inaccessible-local-constant.json b/tests/goldens/compiler/failure/declaration-inaccessible-local-constant.json new file mode 100644 index 0000000000..32d7405555 --- /dev/null +++ b/tests/goldens/compiler/failure/declaration-inaccessible-local-constant.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Constant 'order_cap' is known but inaccessible in '/models/staging/stg_orders.sql'. It is defined at models/marts/_constants/limits.sql:1:1 with local scope owned by 'models/marts'; consumer path: '/models/staging/stg_orders.sql'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/declaration-invalid-constant-reference.json b/tests/goldens/compiler/failure/declaration-invalid-constant-reference.json new file mode 100644 index 0000000000..407aef0a1a --- /dev/null +++ b/tests/goldens/compiler/failure/declaration-invalid-constant-reference.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Invalid constant reference in '/models/staging/stg_orders.sql'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/declaration-root-nested.json b/tests/goldens/compiler/failure/declaration-root-nested.json new file mode 100644 index 0000000000..1a803d6726 --- /dev/null +++ b/tests/goldens/compiler/failure/declaration-root-nested.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "Declaration root models/marts/_enums/_constants/ is nested inside another declaration tree" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/declaration-unclosed-quote-before-reference.json b/tests/goldens/compiler/failure/declaration-unclosed-quote-before-reference.json new file mode 100644 index 0000000000..df2f8f4d34 --- /dev/null +++ b/tests/goldens/compiler/failure/declaration-unclosed-quote-before-reference.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Enum and constant expansion contains an unclosed quoted string" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/declaration-unknown-enum-after-macro.json b/tests/goldens/compiler/failure/declaration-unknown-enum-after-macro.json new file mode 100644 index 0000000000..3e9904a035 --- /dev/null +++ b/tests/goldens/compiler/failure/declaration-unknown-enum-after-macro.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Unknown enum 'missing_status' in '/models/staging/stg_orders.sql'. Visible enums: none" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/duplicate-declaration.json b/tests/goldens/compiler/failure/duplicate-declaration.json new file mode 100644 index 0000000000..bbf984bf10 --- /dev/null +++ b/tests/goldens/compiler/failure/duplicate-declaration.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Invalid declaration scope index:\n[S003] Duplicate declaration 'constant:minimum_amount' at models/staging/_sqlbuild/_constants/limits.sql:1:1, models/staging/_sqlbuild/_constants/limits.sql:1:1\n[S003] Duplicate declaration 'constant:minimum_amount' at models/staging/_sqlbuild/_constants/limits.sql:1:1, models/staging/_sqlbuild/_constants/limits.sql:1:1" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/duplicate-hook.json b/tests/goldens/compiler/failure/duplicate-hook.json new file mode 100644 index 0000000000..2a11772cb4 --- /dev/null +++ b/tests/goldens/compiler/failure/duplicate-hook.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D011", + "message": "Duplicate hook name 'note_refresh' found in hooks/python/first.py and hooks/python/second.py" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/duplicate-model.json b/tests/goldens/compiler/failure/duplicate-model.json new file mode 100644 index 0000000000..b9b49b0472 --- /dev/null +++ b/tests/goldens/compiler/failure/duplicate-model.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D007", + "message": "Duplicate model file name found for 'stg_orders' in models/marts/stg_orders.sql and models/staging/stg_orders.sql" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/duplicate-provider.json b/tests/goldens/compiler/failure/duplicate-provider.json new file mode 100644 index 0000000000..2c25af46db --- /dev/null +++ b/tests/goldens/compiler/failure/duplicate-provider.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D012", + "message": "Duplicate provider name 'export_settings' found in providers/first.py and providers/second.py" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/duplicate-python-node.json b/tests/goldens/compiler/failure/duplicate-python-node.json new file mode 100644 index 0000000000..7b8d648d20 --- /dev/null +++ b/tests/goldens/compiler/failure/duplicate-python-node.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D007", + "message": "Duplicate Python node found for 'export_orders' in python/tasks/first.py and python/tasks/second.py; loader, task, asset, and check names must be globally unique" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/duplicate-scenario.json b/tests/goldens/compiler/failure/duplicate-scenario.json new file mode 100644 index 0000000000..1436b1b6b4 --- /dev/null +++ b/tests/goldens/compiler/failure/duplicate-scenario.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D007", + "message": "Duplicate scenario file name found for 'orders' in tests/scenarios/north/orders.sql and tests/scenarios/south/orders.sql" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/duplicate-source.json b/tests/goldens/compiler/failure/duplicate-source.json new file mode 100644 index 0000000000..1b824c951e --- /dev/null +++ b/tests/goldens/compiler/failure/duplicate-source.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D007", + "message": "Duplicate source declaration found for 'raw_orders' in sources/more.yml and sources/raw.yml" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/engine-error-case-folded-duplicate-column.json b/tests/goldens/compiler/failure/engine-error-case-folded-duplicate-column.json new file mode 100644 index 0000000000..8595e5f723 --- /dev/null +++ b/tests/goldens/compiler/failure/engine-error-case-folded-duplicate-column.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/marts/customer_totals.sql model has duplicate column 'größe' (column names are case-insensitive)" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/engine-error-unset-environment-variable.json b/tests/goldens/compiler/failure/engine-error-unset-environment-variable.json new file mode 100644 index 0000000000..d34e094776 --- /dev/null +++ b/tests/goldens/compiler/failure/engine-error-unset-environment-variable.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "unknown environment variable '@@ENV:SQB_ENGINE_ERROR_UNSET_REGION' in '/models/marts/customer_totals.sql'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/engine-error-week-date-cursor-start.json b/tests/goldens/compiler/failure/engine-error-week-date-cursor-start.json new file mode 100644 index 0000000000..c835739003 --- /dev/null +++ b/tests/goldens/compiler/failure/engine-error-week-date-cursor-start.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'customer_totals': cursor_start value '2024-W01-1T25:00' is not a valid ISO timestamp: hour must be in 0..23" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/enum-duplicate-member.json b/tests/goldens/compiler/failure/enum-duplicate-member.json new file mode 100644 index 0000000000..aea3a7ecad --- /dev/null +++ b/tests/goldens/compiler/failure/enum-duplicate-member.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "/models/staging/_sqlbuild/_enums/order_status.sql enum 'order_status' has duplicate member 'PLACED'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/enum-parse.json b/tests/goldens/compiler/failure/enum-parse.json new file mode 100644 index 0000000000..57406a204d --- /dev/null +++ b/tests/goldens/compiler/failure/enum-parse.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "ENUM(...) in '/enums/order_status.sql' contains invalid SQLBuild header syntax: expected value at position 35" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/failing-macro.json b/tests/goldens/compiler/failure/failing-macro.json new file mode 100644 index 0000000000..f8ffc4fae3 --- /dev/null +++ b/tests/goldens/compiler/failure/failing-macro.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Macro '@cents' in '/models/staging/stg_orders.sql' failed: cannot convert amount" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/generic-audit-cursor-intrinsic.json b/tests/goldens/compiler/failure/generic-audit-cursor-intrinsic.json new file mode 100644 index 0000000000..139a76c54e --- /dev/null +++ b/tests/goldens/compiler/failure/generic-audit-cursor-intrinsic.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Audit 'fresh' uses cursor intrinsics, which are only supported in cursor-based incremental model query SQL" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/generic-audit-header.json b/tests/goldens/compiler/failure/generic-audit-header.json new file mode 100644 index 0000000000..3bbb5d34fa --- /dev/null +++ b/tests/goldens/compiler/failure/generic-audit-header.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D004", + "message": "AUDIT() in '/models/marts/_sqlbuild/_audits/generic/at_least.sql:1' has unsupported keys: unknown_option", + "help": "supported keys: always_run, evaluation, minimum_samples, name, run_scope, sample_count, sample_unit, severity, sql_analysis, thresholds, value" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/generic-audit-missing-argument.json b/tests/goldens/compiler/failure/generic-audit-missing-argument.json new file mode 100644 index 0000000000..5e02dc2c5e --- /dev/null +++ b/tests/goldens/compiler/failure/generic-audit-missing-argument.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/staging/stg_orders.sql is missing argument 'minimum' for generic audit 'floor'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/generic-audit-overrides-implicit-model.json b/tests/goldens/compiler/failure/generic-audit-overrides-implicit-model.json new file mode 100644 index 0000000000..31faebe172 --- /dev/null +++ b/tests/goldens/compiler/failure/generic-audit-overrides-implicit-model.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/staging/stg_orders.sql audit 'floor' must not override implicit model from attached context" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/generic-audit-unknown-run-scope.json b/tests/goldens/compiler/failure/generic-audit-unknown-run-scope.json new file mode 100644 index 0000000000..f138d91f5f --- /dev/null +++ b/tests/goldens/compiler/failure/generic-audit-unknown-run-scope.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "unknown audit run_scope 'always'; valid values: delta_and_final, final" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/hard-coded-relation-in-python.json b/tests/goldens/compiler/failure/hard-coded-relation-in-python.json new file mode 100644 index 0000000000..6002c32dfd --- /dev/null +++ b/tests/goldens/compiler/failure/hard-coded-relation-in-python.json @@ -0,0 +1,270 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P008", + "message": "task:export_orders names model:stg_orders as 'stg_orders' in SQL passed to ctx.query()", + "path": "python/tasks/exports.py", + "line": 7, + "column": 1, + "location": { + "path": "python/tasks/exports.py", + "line": 7, + "column": 1 + }, + "help": "declare it with depends_on=model(\"stg_orders\") and use ctx.relation(model(\"stg_orders\")) instead of the relation name\n = help: if 'stg_orders' is an external table that shares the name, qualify it with its schema\n = help: the current value is [references] enforce_explicit = true (from sqlbuild_project.toml or its default); while migrating a project, to allow hard-coded relation names, set this in sqlbuild_project.toml:\n [references]\n enforce_explicit = false" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/header-audit-identity.json b/tests/goldens/compiler/failure/header-audit-identity.json new file mode 100644 index 0000000000..90bd441865 --- /dev/null +++ b/tests/goldens/compiler/failure/header-audit-identity.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D016", + "message": "Invalid model audit definition identity 'NotNull' in models/staging/stg_orders.sql; use snake_case 'not_null'", + "help": "Rename the authored identity and update its references, selectors, and integration keys. SQLBuild does not silently normalize resource identities. Double underscores remain valid." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/header-audit-severity.json b/tests/goldens/compiler/failure/header-audit-severity.json new file mode 100644 index 0000000000..c4c39c8630 --- /dev/null +++ b/tests/goldens/compiler/failure/header-audit-severity.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/staging/stg_orders.sql model audit 'unique_combination' 'severity' must be one of: warn, error" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/header-column-audits-not-a-list.json b/tests/goldens/compiler/failure/header-column-audits-not-a-list.json new file mode 100644 index 0000000000..411e67da84 --- /dev/null +++ b/tests/goldens/compiler/failure/header-column-audits-not-a-list.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/staging/stg_orders.sql model column 'order_id' audits must be a list" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/header-column-type-not-text.json b/tests/goldens/compiler/failure/header-column-type-not-text.json new file mode 100644 index 0000000000..f3b20117b1 --- /dev/null +++ b/tests/goldens/compiler/failure/header-column-type-not-text.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/staging/stg_orders.sql model column 'order_id' 'type' must be a non-empty string" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/header-column-unknown-metadata-key.json b/tests/goldens/compiler/failure/header-column-unknown-metadata-key.json new file mode 100644 index 0000000000..26fd68c93b --- /dev/null +++ b/tests/goldens/compiler/failure/header-column-unknown-metadata-key.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/staging/stg_orders.sql model column 'order_id' has unknown metadata keys: format" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/header-duplicate-column.json b/tests/goldens/compiler/failure/header-duplicate-column.json new file mode 100644 index 0000000000..33959188fb --- /dev/null +++ b/tests/goldens/compiler/failure/header-duplicate-column.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/staging/stg_orders.sql model has duplicate column 'ORDER_ID' (column names are case-insensitive)" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/hook-reads-dependant.json b/tests/goldens/compiler/failure/hook-reads-dependant.json new file mode 100644 index 0000000000..58c2f1bc67 --- /dev/null +++ b/tests/goldens/compiler/failure/hook-reads-dependant.json @@ -0,0 +1,280 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P007", + "message": "Python hook 'note_refresh' on model 'stg_orders' reads model 'customer_totals', which depends on 'stg_orders'; a hook runs as part of its model, so it cannot wait for a resource built from that model", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/_sqlbuild/_hooks/python/notes.py", + "help": "attach the hook to a model built after 'customer_totals', or drop the read and use ctx.destination for 'stg_orders' itself" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "python", + "name": "note_refresh", + "kwargs": {}, + "relative_path": "models/staging/_sqlbuild/_hooks/python/notes.py", + "definition_hash": "5d9bbe39d4017828edf4fac4743dc8253cd0f9b3d65779e5f9cff6100bee89dd", + "version_hash": "38cb2db363acaa4f13ad2ac96e920b672895acf529c55e86c75d1ab2c73137a9" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/hook-role-unsupported-entry.json b/tests/goldens/compiler/failure/hook-role-unsupported-entry.json new file mode 100644 index 0000000000..c9109a0c9a --- /dev/null +++ b/tests/goldens/compiler/failure/hook-role-unsupported-entry.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "Unsupported entries in models/marts/_sqlbuild/hooks/: models/marts/_sqlbuild/hooks/notes.sql; hooks/ accepts only python/, sql/" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/hook-unknown-argument.json b/tests/goldens/compiler/failure/hook-unknown-argument.json new file mode 100644 index 0000000000..accbb62629 --- /dev/null +++ b/tests/goldens/compiler/failure/hook-unknown-argument.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "/models/marts/customer_totals.sql post_hooks[0] sql(\"record_refresh\") passes unknown argument(s) to SQL hook 'record_refresh' in hooks/sql/record_refresh.sql: tag" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/hook-without-header.json b/tests/goldens/compiler/failure/hook-without-header.json new file mode 100644 index 0000000000..0ab3158d7b --- /dev/null +++ b/tests/goldens/compiler/failure/hook-without-header.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D014", + "message": "SQL hook '/hooks/sql/record_refresh.sql' must start with a HOOK() header as the first non-whitespace content" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/inaccessible-declaration.json b/tests/goldens/compiler/failure/inaccessible-declaration.json new file mode 100644 index 0000000000..905dddc45a --- /dev/null +++ b/tests/goldens/compiler/failure/inaccessible-declaration.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Constant 'minimum_amount' is known but inaccessible in '/models/staging/stg_orders.sql'. It is defined at models/marts/_sqlbuild/_constants/limits.sql:1:1 with local scope owned by 'models/marts'; consumer path: '/models/staging/stg_orders.sql'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/inherited-declaration-used-in-one-folder.json b/tests/goldens/compiler/failure/inherited-declaration-used-in-one-folder.json new file mode 100644 index 0000000000..45086430ab --- /dev/null +++ b/tests/goldens/compiler/failure/inherited-declaration-used-in-one-folder.json @@ -0,0 +1,270 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "S008", + "message": "Declaration 'constant:minimum_amount' is currently descendant-public at 'models/staging' (models/staging/_sqlbuild/constants/limits.sql); required exact-owner-private at 'models/staging'. Consumers: model:stg_orders. Move it to 'models/staging/_sqlbuild/_constants/'", + "path": "models/staging/_sqlbuild/constants/limits.sql", + "line": 1, + "column": 1, + "location": { + "path": "models/staging/_sqlbuild/constants/limits.sql", + "line": 1, + "column": 1 + } + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "WHERE amount > 1", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/invalid-decimal-constant.json b/tests/goldens/compiler/failure/invalid-decimal-constant.json new file mode 100644 index 0000000000..a1488abd9f --- /dev/null +++ b/tests/goldens/compiler/failure/invalid-decimal-constant.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "/models/staging/_sqlbuild/_constants/limits.sql constant 'minimum_amount' has invalid decimal value 'ten'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/invalid-declaration-name.json b/tests/goldens/compiler/failure/invalid-declaration-name.json new file mode 100644 index 0000000000..74a1835434 --- /dev/null +++ b/tests/goldens/compiler/failure/invalid-declaration-name.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D016", + "message": "Invalid public constant identity 'MinimumAmount' in /models/staging/_sqlbuild/_constants/limits.sql; use snake_case 'minimum_amount'", + "help": "Rename the authored identity and update its references, selectors, and integration keys. SQLBuild does not silently normalize resource identities. Double underscores remain valid." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/invalid-reference-calls-in-two-files.json b/tests/goldens/compiler/failure/invalid-reference-calls-in-two-files.json new file mode 100644 index 0000000000..021ff54895 --- /dev/null +++ b/tests/goldens/compiler/failure/invalid-reference-calls-in-two-files.json @@ -0,0 +1,285 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__ref(stg_orders) is not a valid __ref() call", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 23 + }, + "help": "__ref() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __ref(\"stg_orders\")" + }, + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__source('raw_orders') is not a valid __source() call", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 28 + }, + "help": "__source() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __source(\"raw_orders\")" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(stg_orders)", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source('raw_orders')", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/invalid-resource-name.json b/tests/goldens/compiler/failure/invalid-resource-name.json new file mode 100644 index 0000000000..33c6c184a5 --- /dev/null +++ b/tests/goldens/compiler/failure/invalid-resource-name.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D016", + "message": "Invalid model identity 'order-totals' in models/marts/order-totals.sql; use snake_case 'order_totals'", + "help": "Rename the authored identity and update its references, selectors, and integration keys. SQLBuild does not silently normalize resource identities. Double underscores remain valid." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/legacy-event-exporters-directory.json b/tests/goldens/compiler/failure/legacy-event-exporters-directory.json new file mode 100644 index 0000000000..2c0a87d690 --- /dev/null +++ b/tests/goldens/compiler/failure/legacy-event-exporters-directory.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D015", + "message": "event_exporters/ was replaced by sinks/ and @lifecycle_event_sink" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/lifecycle-sink-default-parameter.json b/tests/goldens/compiler/failure/lifecycle-sink-default-parameter.json new file mode 100644 index 0000000000..04787f8f41 --- /dev/null +++ b/tests/goldens/compiler/failure/lifecycle-sink-default-parameter.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D015", + "message": "Event exporter 'ignore_events' in sinks/lifecycle.py parameters must not have defaults" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/lifecycle-sink-unknown-provider.json b/tests/goldens/compiler/failure/lifecycle-sink-unknown-provider.json new file mode 100644 index 0000000000..e1b706e978 --- /dev/null +++ b/tests/goldens/compiler/failure/lifecycle-sink-unknown-provider.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D015", + "message": "Event exporter 'publish_events' in sinks/lifecycle.py requires unknown provider 'destination_client'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/lineage-opted-out-except-and-ctes.json b/tests/goldens/compiler/failure/lineage-opted-out-except-and-ctes.json new file mode 100644 index 0000000000..0e07d34bb1 --- /dev/null +++ b/tests/goldens/compiler/failure/lineage-opted-out-except-and-ctes.json @@ -0,0 +1,353 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B004", + "message": "Unknown table or alias 'x' referenced by column 'order_id'", + "resource_type": "model", + "resource_name": "broken_orders", + "path": "models/marts/broken_orders.sql", + "line": 5, + "column": 8, + "location": { + "path": "models/marts/broken_orders.sql", + "line": 5, + "column": 8, + "end_line": 5, + "end_column": 9 + }, + "help": "give each referenced relation a visible alias in this scope" + } + ] + } + ], + "compiled": { + "models/marts/broken_orders.sql": [ + "SELECT x.order_id", + "FROM __ref(\"stg_orders\") o", + "" + ], + "models/marts/customer_totals.sql": [ + "WITH kept AS (SELECT customer_id FROM __ref(\"stg_orders\")),", + "again AS (SELECT * FROM kept)", + "SELECT customer_id, COUNT(*) AS total_amount FROM again GROUP BY 1", + "EXCEPT", + "SELECT customer_id, amount FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.broken_orders": { + "database": null, + "schema": "main", + "name": "broken_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/broken_orders.sql", + "original_file_path": "models/marts/broken_orders.sql", + "unique_id": "model.failure_corpus.broken_orders", + "fqn": [ + "failure_corpus", + "models", + "marts", + "broken_orders" + ], + "alias": "broken_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Orders with an unknown qualifier", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.broken_orders", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.broken_orders": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/lineage-opted-out-quoted-columns.json b/tests/goldens/compiler/failure/lineage-opted-out-quoted-columns.json new file mode 100644 index 0000000000..708c091054 --- /dev/null +++ b/tests/goldens/compiler/failure/lineage-opted-out-quoted-columns.json @@ -0,0 +1,352 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B004", + "message": "Unknown table or alias 'x' referenced by column 'order_id'", + "resource_type": "model", + "resource_name": "broken_orders", + "path": "models/marts/broken_orders.sql", + "line": 5, + "column": 8, + "location": { + "path": "models/marts/broken_orders.sql", + "line": 5, + "column": 8, + "end_line": 5, + "end_column": 9 + }, + "help": "give each referenced relation a visible alias in this scope" + } + ] + } + ], + "compiled": { + "models/marts/broken_orders.sql": [ + "SELECT x.order_id", + "FROM __ref(\"stg_orders\") o", + "" + ], + "models/marts/customer_totals.sql": [ + "SELECT \"Customer_ID\", SUM(O.Amount) AS \"Total_Amount\",", + " CAST(MAX(o.status) AS VARCHAR) AS last_status, 'fixed' AS label", + "FROM __ref(\"stg_orders\") AS O", + "GROUP BY 1", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.broken_orders": { + "database": null, + "schema": "main", + "name": "broken_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/broken_orders.sql", + "original_file_path": "models/marts/broken_orders.sql", + "unique_id": "model.failure_corpus.broken_orders", + "fqn": [ + "failure_corpus", + "models", + "marts", + "broken_orders" + ], + "alias": "broken_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Orders with an unknown qualifier", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.broken_orders", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.broken_orders": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/lineage-opted-out-star.json b/tests/goldens/compiler/failure/lineage-opted-out-star.json new file mode 100644 index 0000000000..0d8db9c495 --- /dev/null +++ b/tests/goldens/compiler/failure/lineage-opted-out-star.json @@ -0,0 +1,350 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B004", + "message": "Unknown table or alias 'x' referenced by column 'order_id'", + "resource_type": "model", + "resource_name": "broken_orders", + "path": "models/marts/broken_orders.sql", + "line": 5, + "column": 8, + "location": { + "path": "models/marts/broken_orders.sql", + "line": 5, + "column": 8, + "end_line": 5, + "end_column": 9 + }, + "help": "give each referenced relation a visible alias in this scope" + } + ] + } + ], + "compiled": { + "models/marts/broken_orders.sql": [ + "SELECT x.order_id", + "FROM __ref(\"stg_orders\") o", + "" + ], + "models/marts/customer_totals.sql": [ + "SELECT o.order_id AS first_order, o.*", + "FROM __ref(\"stg_orders\") o", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.broken_orders": { + "database": null, + "schema": "main", + "name": "broken_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/broken_orders.sql", + "original_file_path": "models/marts/broken_orders.sql", + "unique_id": "model.failure_corpus.broken_orders", + "fqn": [ + "failure_corpus", + "models", + "marts", + "broken_orders" + ], + "alias": "broken_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Orders with an unknown qualifier", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.broken_orders", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.broken_orders": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/lineage-opted-out-union-of-stars.json b/tests/goldens/compiler/failure/lineage-opted-out-union-of-stars.json new file mode 100644 index 0000000000..854fbc877f --- /dev/null +++ b/tests/goldens/compiler/failure/lineage-opted-out-union-of-stars.json @@ -0,0 +1,354 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B004", + "message": "Unknown table or alias 'x' referenced by column 'order_id'", + "resource_type": "model", + "resource_name": "broken_orders", + "path": "models/marts/broken_orders.sql", + "line": 5, + "column": 8, + "location": { + "path": "models/marts/broken_orders.sql", + "line": 5, + "column": 8, + "end_line": 5, + "end_column": 9 + }, + "help": "give each referenced relation a visible alias in this scope" + } + ] + } + ], + "compiled": { + "models/marts/broken_orders.sql": [ + "SELECT x.order_id", + "FROM __ref(\"stg_orders\") o", + "" + ], + "models/marts/customer_totals.sql": [ + "SELECT *, 1 AS copy_number", + "FROM __ref(\"stg_orders\")", + "UNION ALL", + "SELECT \"R\".*, 2 FROM __source(\"raw_orders\") AS \"R\" JOIN __ref(\"stg_orders\") s ON TRUE", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.broken_orders": { + "database": null, + "schema": "main", + "name": "broken_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/broken_orders.sql", + "original_file_path": "models/marts/broken_orders.sql", + "unique_id": "model.failure_corpus.broken_orders", + "fqn": [ + "failure_corpus", + "models", + "marts", + "broken_orders" + ], + "alias": "broken_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Orders with an unknown qualifier", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.broken_orders", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders", + "source.failure_corpus.raw_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.broken_orders": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders", + "source.failure_corpus.raw_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/list-constant-mixed-types.json b/tests/goldens/compiler/failure/list-constant-mixed-types.json new file mode 100644 index 0000000000..e1ef440e76 --- /dev/null +++ b/tests/goldens/compiler/failure/list-constant-mixed-types.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "/models/staging/_sqlbuild/_constants/statuses.sql constant 'kept_statuses'[1] has type integer; expected string" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/local-config-unknown-key.json b/tests/goldens/compiler/failure/local-config-unknown-key.json new file mode 100644 index 0000000000..82ca337180 --- /dev/null +++ b/tests/goldens/compiler/failure/local-config-unknown-key.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D001", + "message": "/sqlbuild_local.toml settings contains unknown key(s): sql_analysiss. Allowed keys: auto_load_sources, column_contract_mode, concurrency, default_audit_run_scope, default_audit_severity, max_concurrency, microbatch_concurrency, microbatch_unaccounted_partition_policy, query_change_tracking, require_sql_analysis, sql_analysis, sql_validation, table_promotion_mode", + "help": "did you mean 'sql_analysis'?" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/local-macro-needed-below-owner.json b/tests/goldens/compiler/failure/local-macro-needed-below-owner.json new file mode 100644 index 0000000000..5f0025f710 --- /dev/null +++ b/tests/goldens/compiler/failure/local-macro-needed-below-owner.json @@ -0,0 +1,412 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "S007", + "message": "Declaration 'macro:cents' is currently exact-owner-private at 'models/staging' (models/staging/_sqlbuild/_macros/orders.py); required exact-owner-private at 'models/staging/regional'. Consumers: macro:wrapped. Move it to 'models/staging/regional/_sqlbuild/_macros/'", + "path": "models/staging/_sqlbuild/_macros/orders.py", + "line": 1, + "column": 1, + "location": { + "path": "models/staging/_sqlbuild/_macros/orders.py", + "line": 1, + "column": 1 + } + }, + { + "phase": "compile", + "severity": "error", + "code": "S008", + "message": "Declaration 'macro:wrapped' is currently descendant-public at 'models/staging' (models/staging/_sqlbuild/macros/wrapping.py); required exact-owner-private at 'models/staging/regional'. Consumers: model:stg_regional_orders. Move it to 'models/staging/regional/_sqlbuild/_macros/'", + "path": "models/staging/_sqlbuild/macros/wrapping.py", + "line": 4, + "column": 1, + "location": { + "path": "models/staging/_sqlbuild/macros/wrapping.py", + "line": 4, + "column": 1 + } + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/regional/stg_regional_orders.sql": [ + "SELECT order_id, (amount * 100) AS amount_cents", + "FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_regional_orders": { + "database": null, + "schema": "main", + "name": "stg_regional_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/regional/stg_regional_orders.sql", + "original_file_path": "models/staging/regional/stg_regional_orders.sql", + "unique_id": "model.failure_corpus.stg_regional_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "regional", + "stg_regional_orders" + ], + "alias": "stg_regional_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Regional orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_regional_orders", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.failure_corpus.cents": { + "name": "cents", + "resource_type": "macro", + "package_name": "failure_corpus", + "path": "models/staging/_sqlbuild/_macros/orders.py", + "original_file_path": "models/staging/_sqlbuild/_macros/orders.py", + "unique_id": "macro.failure_corpus.cents", + "macro_sql": "def cents(expression: str) -> str:\n \"\"\"Convert to cents.\"\"\"\n return f\"({expression} * 100)\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/staging" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.failure_corpus.wrapped": { + "name": "wrapped", + "resource_type": "macro", + "package_name": "failure_corpus", + "path": "models/staging/_sqlbuild/macros/wrapping.py", + "original_file_path": "models/staging/_sqlbuild/macros/wrapping.py", + "unique_id": "macro.failure_corpus.wrapped", + "macro_sql": "from models.staging._sqlbuild._macros.orders import cents\n\n\ndef wrapped(expression: str) -> str:\n \"\"\"Wrap cents.\"\"\"\n return cents(expression)\n", + "depends_on": { + "macros": [ + "macro.failure_corpus.cents" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "inherited", + "sqlbuild_scope_path": "models/staging" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_regional_orders": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/local-singular-audit.json b/tests/goldens/compiler/failure/local-singular-audit.json new file mode 100644 index 0000000000..5e954f12ed --- /dev/null +++ b/tests/goldens/compiler/failure/local-singular-audit.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "models/marts/_sqlbuild/_audits/singular/ is invalid: singular audits are never used by name, so folder-only visibility has no meaning; use _sqlbuild/audits/singular/" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/macro-arguments-do-not-parse.json b/tests/goldens/compiler/failure/macro-arguments-do-not-parse.json new file mode 100644 index 0000000000..76bd9e282b --- /dev/null +++ b/tests/goldens/compiler/failure/macro-arguments-do-not-parse.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Macro arguments in '/models/staging/stg_orders.sql' could not be parsed: invalid syntax (, line 1)" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/macro-first-of-two-failing-models.json b/tests/goldens/compiler/failure/macro-first-of-two-failing-models.json new file mode 100644 index 0000000000..9a92d52682 --- /dev/null +++ b/tests/goldens/compiler/failure/macro-first-of-two-failing-models.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Macro '@blow_up' in '/models/marts/customer_totals.sql' failed: cannot render total" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/macro-generated-reference.json b/tests/goldens/compiler/failure/macro-generated-reference.json new file mode 100644 index 0000000000..f778bac568 --- /dev/null +++ b/tests/goldens/compiler/failure/macro-generated-reference.json @@ -0,0 +1,290 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P006", + "message": "model:customer_totals depends on model:stg_orders through macro staged_orders()", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/_sqlbuild/_macros/orders.py", + "help": "write the reference in the model, or pass it in: @staged_orders(__ref(\"stg_orders\"))\n = help: the current value is [references] enforce_explicit = true (from sqlbuild_project.toml or its default); while migrating a project, to allow macro-generated references, set this in sqlbuild_project.toml:\n [references]\n enforce_explicit = false" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.failure_corpus.staged_orders": { + "name": "staged_orders", + "resource_type": "macro", + "package_name": "failure_corpus", + "path": "models/marts/_sqlbuild/_macros/orders.py", + "original_file_path": "models/marts/_sqlbuild/_macros/orders.py", + "unique_id": "macro.failure_corpus.staged_orders", + "macro_sql": "def staged_orders() -> str:\n \"\"\"Return the staged orders relation.\"\"\"\n return '__ref(\"stg_orders\")'\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/marts" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/macro-import-cycle.json b/tests/goldens/compiler/failure/macro-import-cycle.json new file mode 100644 index 0000000000..9eebdc8491 --- /dev/null +++ b/tests/goldens/compiler/failure/macro-import-cycle.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Macro import cycle in 'macros/first.py': macros.first -> macros.second -> macros.first" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/macro-in-sibling-scope.json b/tests/goldens/compiler/failure/macro-in-sibling-scope.json new file mode 100644 index 0000000000..0865f3526a --- /dev/null +++ b/tests/goldens/compiler/failure/macro-in-sibling-scope.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Macro '@cents' in '/models/staging/stg_orders.sql' is inaccessible. Defined at 'models/marts/_sqlbuild/_macros/orders.py:1:1' with scope owner 'models/marts'; consumer/definition path is '/models/staging/stg_orders.sql'. Visible macros: none" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/macro-non-literal-argument.json b/tests/goldens/compiler/failure/macro-non-literal-argument.json new file mode 100644 index 0000000000..c2bf929aa5 --- /dev/null +++ b/tests/goldens/compiler/failure/macro-non-literal-argument.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Macro arguments in '/models/staging/stg_orders.sql' must use only Python literals, nested macro calls, and __ref(), __source(), or __seed() references" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/macro-output-calls-macro.json b/tests/goldens/compiler/failure/macro-output-calls-macro.json new file mode 100644 index 0000000000..d12c7c95d7 --- /dev/null +++ b/tests/goldens/compiler/failure/macro-output-calls-macro.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Macro '@wrapped' in '/models/staging/stg_orders.sql' returned SQLBuild call(s) @cents(). Macro output must be final SQL. Compose macros with ordinary Python imports and function calls instead; nested @macro() calls are supported only when explicitly authored in SQL" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/macro-private-helper.json b/tests/goldens/compiler/failure/macro-private-helper.json new file mode 100644 index 0000000000..e8581dc32d --- /dev/null +++ b/tests/goldens/compiler/failure/macro-private-helper.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Unknown macro '@_scaled' in '/models/staging/stg_orders.sql'. Available macros: cents" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/macro-raises-after-a-call.json b/tests/goldens/compiler/failure/macro-raises-after-a-call.json new file mode 100644 index 0000000000..acab2b6871 --- /dev/null +++ b/tests/goldens/compiler/failure/macro-raises-after-a-call.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Macro '@explode' in '/models/staging/stg_orders.sql' failed: cannot render status" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/macro-returned-invalid-reference-call.json b/tests/goldens/compiler/failure/macro-returned-invalid-reference-call.json new file mode 100644 index 0000000000..fd55833526 --- /dev/null +++ b/tests/goldens/compiler/failure/macro-returned-invalid-reference-call.json @@ -0,0 +1,295 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__ref(stg_orders) is not a valid __ref() call, returned by macro staged_orders()", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/_sqlbuild/_macros/orders.py", + "line": 3, + "column": 13, + "location": { + "path": "models/marts/_sqlbuild/_macros/orders.py", + "line": 3, + "column": 13, + "end_line": 3, + "end_column": 30 + }, + "help": "write __ref(\"stg_orders\") in the model and pass it in: @staged_orders(__ref(\"stg_orders\"))\n = help: __ref() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __ref(\"stg_orders\")" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(stg_orders)", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.failure_corpus.staged_orders": { + "name": "staged_orders", + "resource_type": "macro", + "package_name": "failure_corpus", + "path": "models/marts/_sqlbuild/_macros/orders.py", + "original_file_path": "models/marts/_sqlbuild/_macros/orders.py", + "unique_id": "macro.failure_corpus.staged_orders", + "macro_sql": "def staged_orders() -> str:\n \"\"\"Return the staged orders relation.\"\"\"\n return '__ref(stg_orders)'\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/marts" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/macro-returns-non-string.json b/tests/goldens/compiler/failure/macro-returns-non-string.json new file mode 100644 index 0000000000..4a74fb3132 --- /dev/null +++ b/tests/goldens/compiler/failure/macro-returns-non-string.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Macro '@answer' in '/models/staging/stg_orders.sql' must return a SQL string when used directly in SQL" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/macro-test-helper-calls-udf.json b/tests/goldens/compiler/failure/macro-test-helper-calls-udf.json new file mode 100644 index 0000000000..3468b46e88 --- /dev/null +++ b/tests/goldens/compiler/failure/macro-test-helper-calls-udf.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL test 'tests/unit/test_cents.sql' mode 'macro' helper CTE 'labels' must not call udf; call reusable logic only in __macro_actual__" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/macro-test-helper-malformed-reference.json b/tests/goldens/compiler/failure/macro-test-helper-malformed-reference.json new file mode 100644 index 0000000000..07233323af --- /dev/null +++ b/tests/goldens/compiler/failure/macro-test-helper-malformed-reference.json @@ -0,0 +1,305 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__source(\"raw\", \"orders\") is not a valid __source() call", + "path": "tests/unit/test_cents.sql", + "line": 6, + "column": 33, + "location": { + "path": "tests/unit/test_cents.sql", + "line": 6, + "column": 33, + "end_line": 6, + "end_column": 58 + }, + "help": "__source() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __source(\"source_name\")" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ], + "tests/macro test_cents/test_cents.sql": [ + "WITH input_values AS (SELECT 5 AS amount),", + "sample_orders AS (SELECT * FROM __source(\"raw\", \"orders\")),", + "__actual__macro_test_cents AS (SELECT (amount * 100) AS cents FROM input_values),", + "__expected__macro_test_cents AS (SELECT 500 AS cents)", + "SELECT 0 AS step_index, 'macro test_cents' AS model_name, (SELECT COUNT(*) FROM __actual__macro_test_cents) AS actual_count, (SELECT COUNT(*) FROM __expected__macro_test_cents) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__macro_test_cents EXCEPT SELECT * FROM __expected__macro_test_cents) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__macro_test_cents EXCEPT SELECT * FROM __actual__macro_test_cents) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.failure_corpus.cents": { + "name": "cents", + "resource_type": "macro", + "package_name": "failure_corpus", + "path": "tests/unit/_macros/orders.py", + "original_file_path": "tests/unit/_macros/orders.py", + "unique_id": "macro.failure_corpus.cents", + "macro_sql": "def cents(expression: str) -> str:\n \"\"\"Convert to cents.\"\"\"\n return f\"({expression} * 100)\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "tests/unit" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/macro-test-quoted-cte-name.json b/tests/goldens/compiler/failure/macro-test-quoted-cte-name.json new file mode 100644 index 0000000000..c120d3ab4e --- /dev/null +++ b/tests/goldens/compiler/failure/macro-test-quoted-cte-name.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL test 'tests/unit/test_stg_orders.sql' CTE name \"__macro_actual__\" must be an unquoted identifier of ASCII letters, digits and underscores\n --> tests/unit/test_stg_orders.sql:4:1", + "help": "rename the CTE, for example __macro_actual__; quoted CTE names and names with $ or non-ASCII characters are not supported" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/managed-source-without-loader.json b/tests/goldens/compiler/failure/managed-source-without-loader.json new file mode 100644 index 0000000000..470980d011 --- /dev/null +++ b/tests/goldens/compiler/failure/managed-source-without-loader.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D007", + "message": "Managed source 'loaded_products' in sources/raw.yml requires loader 'loaded_products'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/materialization-import-error.json b/tests/goldens/compiler/failure/materialization-import-error.json new file mode 100644 index 0000000000..c135e75ea8 --- /dev/null +++ b/tests/goldens/compiler/failure/materialization-import-error.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D011", + "message": "Failed to import materialization file materializations/copy_table.py: No module named 'missing_warehouse_client'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/missing-description.json b/tests/goldens/compiler/failure/missing-description.json new file mode 100644 index 0000000000..996e78aa3c --- /dev/null +++ b/tests/goldens/compiler/failure/missing-description.json @@ -0,0 +1,272 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P010", + "message": "model 'stg_orders' has no description", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "line": 1, + "column": 1, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 1, + "column": 1 + }, + "help": "to describe model 'stg_orders', add this to the MODEL header in models/staging/stg_orders.sql:\n MODEL (\n description \"What one row of stg_orders represents\",\n ...\n );" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/model-blank-column-type.json b/tests/goldens/compiler/failure/model-blank-column-type.json new file mode 100644 index 0000000000..bfb4d464a3 --- /dev/null +++ b/tests/goldens/compiler/failure/model-blank-column-type.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/staging/stg_orders.sql model column 'amount' 'type' must be a non-empty string" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-bom.json b/tests/goldens/compiler/failure/model-bom.json new file mode 100644 index 0000000000..46c3a414d8 --- /dev/null +++ b/tests/goldens/compiler/failure/model-bom.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D002", + "message": "SQL model '/models/staging/stg_orders.sql' must start with a MODEL(...) header as the first non-whitespace content" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-column-audit-unknown-severity.json b/tests/goldens/compiler/failure/model-column-audit-unknown-severity.json new file mode 100644 index 0000000000..12389687b5 --- /dev/null +++ b/tests/goldens/compiler/failure/model-column-audit-unknown-severity.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/staging/stg_orders.sql model column 'amount' audit 'not_null' 'severity' must be one of: warn, error" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-duplicate-column.json b/tests/goldens/compiler/failure/model-duplicate-column.json new file mode 100644 index 0000000000..db3b188fff --- /dev/null +++ b/tests/goldens/compiler/failure/model-duplicate-column.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/staging/stg_orders.sql model has duplicate column 'AMOUNT' (column names are case-insensitive)" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-header-nested-too-deep.json b/tests/goldens/compiler/failure/model-header-nested-too-deep.json new file mode 100644 index 0000000000..f0eb3e117e --- /dev/null +++ b/tests/goldens/compiler/failure/model-header-nested-too-deep.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D002", + "message": "MODEL(...) in '/models/staging/stg_orders.sql:3' contains invalid SQLBuild header syntax: values nest deeper than 256 levels", + "help": "flatten the value so it nests at most 256 levels deep" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-header-syntax.json b/tests/goldens/compiler/failure/model-header-syntax.json new file mode 100644 index 0000000000..5d3b1f5aca --- /dev/null +++ b/tests/goldens/compiler/failure/model-header-syntax.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D002", + "message": "MODEL(...) in '/models/staging/stg_orders.sql' contains invalid SQLBuild header syntax: expected key at position 50" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-missing-header.json b/tests/goldens/compiler/failure/model-missing-header.json new file mode 100644 index 0000000000..46c3a414d8 --- /dev/null +++ b/tests/goldens/compiler/failure/model-missing-header.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D002", + "message": "SQL model '/models/staging/stg_orders.sql' must start with a MODEL(...) header as the first non-whitespace content" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-nullable-column-with-not-null.json b/tests/goldens/compiler/failure/model-nullable-column-with-not-null.json new file mode 100644 index 0000000000..0c8e55f2d1 --- /dev/null +++ b/tests/goldens/compiler/failure/model-nullable-column-with-not-null.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P002", + "message": "models/staging/stg_orders.sql column 'amount' cannot set nullable = true and audit not_null", + "help": "remove the not_null audit or set nullable = false" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-path-not-utf8.json b/tests/goldens/compiler/failure/model-path-not-utf8.json new file mode 100644 index 0000000000..a04a655ed8 --- /dev/null +++ b/tests/goldens/compiler/failure/model-path-not-utf8.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D016", + "message": "Project path /models/staging/caf\\xe9.sql is not valid UTF-8; rename it so SQLBuild can read it" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-private-enum-misuse.json b/tests/goldens/compiler/failure/model-private-enum-misuse.json new file mode 100644 index 0000000000..e1cf0a0865 --- /dev/null +++ b/tests/goldens/compiler/failure/model-private-enum-misuse.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Unknown member 'PENDING' for enum '_state' in '/models/staging/stg_orders.sql'. Available members: OPEN, CLOSED" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-reserved-name.json b/tests/goldens/compiler/failure/model-reserved-name.json new file mode 100644 index 0000000000..d6fc87b3d8 --- /dev/null +++ b/tests/goldens/compiler/failure/model-reserved-name.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D016", + "message": "Invalid model identity '_chain_' in models/marts/_chain_.sql; use snake_case 'chain'", + "help": "Rename the authored identity and update its references, selectors, and integration keys. SQLBuild does not silently normalize resource identities. Double underscores remain valid." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-sql-syntax.json b/tests/goldens/compiler/failure/model-sql-syntax.json new file mode 100644 index 0000000000..d0fd5e25fc --- /dev/null +++ b/tests/goldens/compiler/failure/model-sql-syntax.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL syntax error in model 'stg_orders' (/models/staging/stg_orders.sql): Unexpected token: Comma", + "help": "if this SQL is valid for your warehouse, skip SQL analysis for this model, add this to the MODEL header:\n MODEL (\n sql_analysis false,\n ...\n );\n and please report the SQL so the parser can support it\n = help: SQL analysis is on for this project; to turn it off for every model, set this in sqlbuild_project.toml:\n [settings]\n sql_analysis = false\n = help: to skip SQL analysis for one run, use `--no-sql-analysis`" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-template-missing-environment.json b/tests/goldens/compiler/failure/model-template-missing-environment.json new file mode 100644 index 0000000000..73fb28ed55 --- /dev/null +++ b/tests/goldens/compiler/failure/model-template-missing-environment.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model config references missing ENV variable 'SQB_DIFFERENTIAL_UNSET'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-template-unknown-function.json b/tests/goldens/compiler/failure/model-template-unknown-function.json new file mode 100644 index 0000000000..598de35743 --- /dev/null +++ b/tests/goldens/compiler/failure/model-template-unknown-function.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model config references unsupported template function 'upper'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-template-unterminated-string.json b/tests/goldens/compiler/failure/model-template-unterminated-string.json new file mode 100644 index 0000000000..928b630a46 --- /dev/null +++ b/tests/goldens/compiler/failure/model-template-unterminated-string.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "template expression has unterminated single-quoted string at position 9" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/model-unknown-header-key.json b/tests/goldens/compiler/failure/model-unknown-header-key.json new file mode 100644 index 0000000000..a7f7d46ce2 --- /dev/null +++ b/tests/goldens/compiler/failure/model-unknown-header-key.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D002", + "message": "MODEL() in '/models/staging/stg_orders.sql:3' has unsupported keys: materialised", + "help": "did you mean 'materialized'?" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/multiple-errors-order.json b/tests/goldens/compiler/failure/multiple-errors-order.json new file mode 100644 index 0000000000..a2e8ee113f --- /dev/null +++ b/tests/goldens/compiler/failure/multiple-errors-order.json @@ -0,0 +1,384 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P010", + "message": "model 'customer_totals' has no description", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 1, + "column": 1, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 1, + "column": 1 + }, + "help": "to describe model 'customer_totals', add this to the MODEL header in models/marts/customer_totals.sql:\n MODEL (\n description \"What one row of customer_totals represents\",\n ...\n );" + }, + { + "phase": "compile", + "severity": "error", + "code": "P010", + "message": "model 'order_counts' has no description", + "resource_type": "model", + "resource_name": "order_counts", + "path": "models/marts/order_counts.sql", + "line": 1, + "column": 1, + "location": { + "path": "models/marts/order_counts.sql", + "line": 1, + "column": 1 + }, + "help": "to describe model 'order_counts', add this to the MODEL header in models/marts/order_counts.sql:\n MODEL (\n description \"What one row of order_counts represents\",\n ...\n );" + }, + { + "phase": "compile", + "severity": "error", + "code": "P010", + "message": "model 'stg_orders' has no description", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "line": 1, + "column": 1, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 1, + "column": 1 + }, + "help": "to describe model 'stg_orders', add this to the MODEL header in models/staging/stg_orders.sql:\n MODEL (\n description \"What one row of stg_orders represents\",\n ...\n );" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/marts/order_counts.sql": [ + "SELECT customer_id, COUNT(*) AS order_count", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.order_counts": { + "database": null, + "schema": "main", + "name": "order_counts", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/order_counts.sql", + "original_file_path": "models/marts/order_counts.sql", + "unique_id": "model.failure_corpus.order_counts", + "fqn": [ + "failure_corpus", + "models", + "marts", + "order_counts" + ], + "alias": "order_counts", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.order_counts", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.order_counts": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/named-hook-missing-argument.json b/tests/goldens/compiler/failure/named-hook-missing-argument.json new file mode 100644 index 0000000000..8d741b20ca --- /dev/null +++ b/tests/goldens/compiler/failure/named-hook-missing-argument.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "/models/marts/customer_totals.sql post_hooks[0] sql(\"record_refresh\") is missing argument 'label' for SQL hook 'record_refresh' in hooks/sql/record_refresh.sql" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/named-role-nested-declaration.json b/tests/goldens/compiler/failure/named-role-nested-declaration.json new file mode 100644 index 0000000000..6f8b5789cc --- /dev/null +++ b/tests/goldens/compiler/failure/named-role-nested-declaration.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "Declaration directory schemas/enums/ is not allowed inside the project-wide schemas/ role; scoped declarations belong under /_sqlbuild/ below a resource tree" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/order-binding-metadata-contract.json b/tests/goldens/compiler/failure/order-binding-metadata-contract.json new file mode 100644 index 0000000000..c515f0891b --- /dev/null +++ b/tests/goldens/compiler/failure/order-binding-metadata-contract.json @@ -0,0 +1,361 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "Unknown column 'refund' in stg_orders", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 25, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 25, + "end_line": 7, + "end_column": 31 + }, + "notes": [ + "stg_orders has: order_id, amount, discount, customer_id, status" + ] + }, + { + "phase": "compile", + "severity": "error", + "code": "B300", + "message": "unique_key references unknown column 'order_key'", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 4, + "column": 15, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 4, + "column": 15 + }, + "help": "change the metadata column name to an existing output column" + }, + { + "phase": "contract", + "severity": "error", + "code": "K001", + "message": "enforced contract column 'discount' was not found in statically inferred output for model 'stg_orders'", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "discount", + "path": "models/staging/stg_orders.sql", + "line": 9, + "column": 5, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 9, + "column": 5, + "end_line": 9, + "end_column": 13 + }, + "help": "add discount to the SELECT list or correct MODEL(columns (...)); validation is active because this model declares contract enforced" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(refund) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "order_key" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "discount": { + "name": "discount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/order-closest-column-help.json b/tests/goldens/compiler/failure/order-closest-column-help.json new file mode 100644 index 0000000000..e50e568592 --- /dev/null +++ b/tests/goldens/compiler/failure/order-closest-column-help.json @@ -0,0 +1,277 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "Unknown column 'amonut' in stg_orders", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 25, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 25, + "end_line": 5, + "end_column": 31 + }, + "help": "did you mean 'amount'?", + "notes": [ + "stg_orders has: amount, status, customer_id, order_id" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amonut) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/order-contract-error-then-warning.json b/tests/goldens/compiler/failure/order-contract-error-then-warning.json new file mode 100644 index 0000000000..742801ce10 --- /dev/null +++ b/tests/goldens/compiler/failure/order-contract-error-then-warning.json @@ -0,0 +1,345 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "contract", + "severity": "error", + "code": "K005", + "message": "column 'status' is not declared in enforced contract for model 'stg_orders'", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "status", + "path": "models/staging/stg_orders.sql", + "line": 12, + "column": 53, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 12, + "column": 53, + "end_line": 12, + "end_column": 59 + }, + "help": "add the column to MODEL(columns) or remove it from the SELECT list" + }, + { + "phase": "contract", + "severity": "warning", + "code": "K003", + "message": "column 'note' type could not be proven against declared VARCHAR", + "resource_type": "model", + "resource_name": "stg_orders", + "column_name": "note", + "path": "models/staging/stg_orders.sql", + "line": 6, + "column": 5, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 6, + "column": 5, + "end_line": 6, + "end_column": 9 + }, + "related_locations": [ + { + "label": "output", + "location": { + "path": "models/staging/stg_orders.sql", + "line": 12, + "column": 18, + "end_line": 12, + "end_column": 30 + }, + "message": "output expression with unproven type" + } + ], + "help": "add an explicit CAST if this declared type should be checked statically" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, NULL AS note, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "note": { + "name": "note", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/order-poisoned-downstream-uses.json b/tests/goldens/compiler/failure/order-poisoned-downstream-uses.json new file mode 100644 index 0000000000..631ed47dc9 --- /dev/null +++ b/tests/goldens/compiler/failure/order-poisoned-downstream-uses.json @@ -0,0 +1,277 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "Unknown column 'refund' in raw_orders", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "line": 5, + "column": 39, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 5, + "column": 39, + "end_line": 5, + "end_column": 45 + }, + "notes": [ + "raw_orders has: order_id, amount, customer_id, status", + "1 downstream output uses were not type-checked because of this error" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(refund) AS total_refund", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, refund, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/order-two-failing-models.json b/tests/goldens/compiler/failure/order-two-failing-models.json new file mode 100644 index 0000000000..c3bfef6368 --- /dev/null +++ b/tests/goldens/compiler/failure/order-two-failing-models.json @@ -0,0 +1,375 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "Unknown column 'missing_column' in stg_orders", + "resource_type": "model", + "resource_name": "order_counts", + "path": "models/marts/order_counts.sql", + "line": 5, + "column": 27, + "location": { + "path": "models/marts/order_counts.sql", + "line": 5, + "column": 27, + "end_line": 5, + "end_column": 41 + }, + "notes": [ + "stg_orders has: discount, amount, status, customer_id, order_id" + ] + }, + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "Unknown column 'discount' in raw_orders", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "line": 5, + "column": 39, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 5, + "column": 39, + "end_line": 5, + "end_column": 47 + }, + "notes": [ + "raw_orders has: amount, customer_id, status, order_id" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/marts/order_counts.sql": [ + "SELECT customer_id, COUNT(missing_column) AS order_count", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, discount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.order_counts": { + "database": null, + "schema": "main", + "name": "order_counts", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/order_counts.sql", + "original_file_path": "models/marts/order_counts.sql", + "unique_id": "model.failure_corpus.order_counts", + "fqn": [ + "failure_corpus", + "models", + "marts", + "order_counts" + ], + "alias": "order_counts", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order counts per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.order_counts", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.order_counts": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/orphan-audit-factory.json b/tests/goldens/compiler/failure/orphan-audit-factory.json new file mode 100644 index 0000000000..99894f52bb --- /dev/null +++ b/tests/goldens/compiler/failure/orphan-audit-factory.json @@ -0,0 +1,286 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "warning", + "code": "C216", + "message": "Audit factory 'order_quality' is not referenced by any model and will not produce audits", + "resource_type": "audit", + "resource_name": "order_quality", + "path": "python/audits/quality.py", + "line": 4, + "column": 1, + "location": { + "path": "python/audits/quality.py", + "line": 4, + "column": 1 + } + }, + { + "phase": "compile", + "severity": "error", + "code": "S024", + "message": "Declaration 'constant:minimum_amount' is currently project at 'constants' (constants/limits.sql); required exact-owner-private at 'models/staging'. Consumers: model:stg_orders. Move it to 'models/staging/_sqlbuild/_constants/'", + "path": "constants/limits.sql", + "line": 1, + "column": 1, + "location": { + "path": "constants/limits.sql", + "line": 1, + "column": 1 + } + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "WHERE amount > 1", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/over-broad-global.json b/tests/goldens/compiler/failure/over-broad-global.json new file mode 100644 index 0000000000..4489bdef1f --- /dev/null +++ b/tests/goldens/compiler/failure/over-broad-global.json @@ -0,0 +1,270 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "S024", + "message": "Declaration 'constant:minimum_amount' is currently project at 'constants' (constants/limits.sql); required exact-owner-private at 'models/staging'. Consumers: model:stg_orders. Move it to 'models/staging/_sqlbuild/_constants/'", + "path": "constants/limits.sql", + "line": 1, + "column": 1, + "location": { + "path": "constants/limits.sql", + "line": 1, + "column": 1 + } + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "WHERE amount > 1", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/path-defaults-unmatched.json b/tests/goldens/compiler/failure/path-defaults-unmatched.json new file mode 100644 index 0000000000..cbd48e3136 --- /dev/null +++ b/tests/goldens/compiler/failure/path-defaults-unmatched.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D007", + "message": "path_defaults['reporting/finance'] does not match any model paths. Known model folders include: marts, staging" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/provider-invalid-settings.json b/tests/goldens/compiler/failure/provider-invalid-settings.json new file mode 100644 index 0000000000..7c7295b81e --- /dev/null +++ b/tests/goldens/compiler/failure/provider-invalid-settings.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D012", + "message": "Provider 'export_settings' in providers/export_settings.py has invalid settings:\napi_token: Field required [missing]" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/python-node-import-error.json b/tests/goldens/compiler/failure/python-node-import-error.json new file mode 100644 index 0000000000..1e4fa38507 --- /dev/null +++ b/tests/goldens/compiler/failure/python-node-import-error.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D011", + "message": "Failed to import Python node file python/tasks/exports.py: No module named 'missing_orders_client'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/python-node-missing-description.json b/tests/goldens/compiler/failure/python-node-missing-description.json new file mode 100644 index 0000000000..139033f6af --- /dev/null +++ b/tests/goldens/compiler/failure/python-node-missing-description.json @@ -0,0 +1,271 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P010", + "message": "task 'export_orders' has no description", + "resource_name": "export_orders", + "path": "python/tasks/exports.py", + "line": 4, + "column": 1, + "location": { + "path": "python/tasks/exports.py", + "line": 4, + "column": 1 + }, + "help": "to describe task 'export_orders', give its function in python/tasks/exports.py a docstring or pass a description to @task:\n @task(description=\"What export_orders does\", ...)" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/python-node-syntax.json b/tests/goldens/compiler/failure/python-node-syntax.json new file mode 100644 index 0000000000..961ba2eae4 --- /dev/null +++ b/tests/goldens/compiler/failure/python-node-syntax.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D011", + "message": "Failed to import Python node file python/tasks/exports.py: invalid syntax (exports.py, line 1)" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/python-outside-extension-root.json b/tests/goldens/compiler/failure/python-outside-extension-root.json new file mode 100644 index 0000000000..30a354b381 --- /dev/null +++ b/tests/goldens/compiler/failure/python-outside-extension-root.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D016", + "message": "Unsupported project Python path(s): helpers/formatting.py", + "help": "Move pipeline Python nodes and the helper modules they import under python/, or move SQLBuild extensions under their documented extension path." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/reference-dbt-three-arguments.json b/tests/goldens/compiler/failure/reference-dbt-three-arguments.json new file mode 100644 index 0000000000..b21a746e88 --- /dev/null +++ b/tests/goldens/compiler/failure/reference-dbt-three-arguments.json @@ -0,0 +1,269 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__dbt_ref(\"shop\", \"orders\", \"extra\") is not a valid __dbt_ref() call", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 42 + }, + "help": "__dbt_ref() takes one double-quoted model name, or a double-quoted package name and model name separated by a comma, with no comments or extra spaces inside the parentheses: __dbt_ref(\"package_name\", \"model_name\")" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT order_id AS customer_id, 1 AS total_amount", + "FROM __dbt_ref(\"shop\", \"orders\", \"extra\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/reference-empty-argument.json b/tests/goldens/compiler/failure/reference-empty-argument.json new file mode 100644 index 0000000000..3021f71bd6 --- /dev/null +++ b/tests/goldens/compiler/failure/reference-empty-argument.json @@ -0,0 +1,269 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__ref(\"stg_orders\", ) is not a valid __ref() call", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 27 + }, + "help": "__ref() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __ref(\"model_name\")" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT order_id AS customer_id, 1 AS total_amount", + "FROM __ref(\"stg_orders\", )", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/reference-error-after-rejected-calls.json b/tests/goldens/compiler/failure/reference-error-after-rejected-calls.json new file mode 100644 index 0000000000..cd15879862 --- /dev/null +++ b/tests/goldens/compiler/failure/reference-error-after-rejected-calls.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/marts/customer_totals.sql:7:39: SQL reference contains an unclosed quoted string" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/reference-expression-name.json b/tests/goldens/compiler/failure/reference-expression-name.json new file mode 100644 index 0000000000..de4eaf4ffc --- /dev/null +++ b/tests/goldens/compiler/failure/reference-expression-name.json @@ -0,0 +1,269 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__ref(concat('stg_', 'orders')) is not a valid __ref() call", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 37 + }, + "help": "__ref() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __ref(\"model_name\")" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT order_id AS customer_id, 1 AS total_amount", + "FROM __ref(concat('stg_', 'orders'))", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/reference-rejected-calls-across-files.json b/tests/goldens/compiler/failure/reference-rejected-calls-across-files.json new file mode 100644 index 0000000000..bc8c93801e --- /dev/null +++ b/tests/goldens/compiler/failure/reference-rejected-calls-across-files.json @@ -0,0 +1,284 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__dbt_ref(shop, orders, extra) is not a valid __dbt_ref() call", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 36 + }, + "help": "__dbt_ref() takes one double-quoted model name, or a double-quoted package name and model name separated by a comma, with no comments or extra spaces inside the parentheses: __dbt_ref(\"package_name\", \"model_name\")" + }, + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__table_fn must be followed by an argument list", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 40 + }, + "help": "pass the function arguments in a second set of parentheses, using () for no arguments: __table_fn(\"table_fn__orders_for\")()" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT order_id AS customer_id, 1 AS total_amount", + "FROM __dbt_ref(shop, orders, extra)", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __table_fn(\"table_fn__orders_for\") -- no call", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/reference-several-rejected-calls-in-one-file.json b/tests/goldens/compiler/failure/reference-several-rejected-calls-in-one-file.json new file mode 100644 index 0000000000..13f1d3968b --- /dev/null +++ b/tests/goldens/compiler/failure/reference-several-rejected-calls-in-one-file.json @@ -0,0 +1,311 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__ref(stg_orders) is not a valid __ref() call", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 8, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 8, + "column": 6, + "end_line": 8, + "end_column": 23 + }, + "help": "__ref() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __ref(\"stg_orders\")" + }, + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__source( 'raw_orders' ) is not a valid __source() call", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 9, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 9, + "column": 6, + "end_line": 9, + "end_column": 30 + }, + "help": "__source() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __source(\"raw_orders\")" + }, + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__seed(\"a\", \"b\") is not a valid __seed() call", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 10, + "column": 47, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 10, + "column": 47, + "end_line": 10, + "end_column": 63 + }, + "help": "__seed() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __seed(\"seed_name\")" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "-- __ref(hidden)", + "SELECT order_id AS customer_id, 'é __ref(hidden)' AS note, $$__ref(hidden)$$ AS body,", + " 1 AS total_amount /* __ref(hidden) */", + "FROM __ref(stg_orders)", + "JOIN __source( 'raw_orders' ) USING (customer_id)", + "WHERE customer_id IN (SELECT customer_id FROM __seed(\"a\", \"b\"))", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/reference-two-name-arguments.json b/tests/goldens/compiler/failure/reference-two-name-arguments.json new file mode 100644 index 0000000000..a419ba1b44 --- /dev/null +++ b/tests/goldens/compiler/failure/reference-two-name-arguments.json @@ -0,0 +1,269 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__ref(\"stg_orders\", \"orders\") is not a valid __ref() call", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 35 + }, + "help": "__ref() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __ref(\"model_name\")" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT order_id AS customer_id, 1 AS total_amount", + "FROM __ref(\"stg_orders\", \"orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/reference-unclosed-call.json b/tests/goldens/compiler/failure/reference-unclosed-call.json new file mode 100644 index 0000000000..ff28d64647 --- /dev/null +++ b/tests/goldens/compiler/failure/reference-unclosed-call.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/marts/customer_totals.sql:6:6: SQL reference contains an unclosed parenthesis" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/resource-name-collision.json b/tests/goldens/compiler/failure/resource-name-collision.json new file mode 100644 index 0000000000..65d112fa88 --- /dev/null +++ b/tests/goldens/compiler/failure/resource-name-collision.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D007", + "message": "Logical relation name 'stg_orders' is declared as both model in models/staging/stg_orders.sql and seed in seeds/stg_orders.yml" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/rule-custom-finding.json b/tests/goldens/compiler/failure/rule-custom-finding.json new file mode 100644 index 0000000000..fae7d107f4 --- /dev/null +++ b/tests/goldens/compiler/failure/rule-custom-finding.json @@ -0,0 +1,27 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "rule", + "severity": "error", + "code": "XSQBRDIFF001", + "message": "Models avoid the stg_ prefix", + "path": "models/staging/stg_orders.sql", + "line": 1, + "column": 1, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 1, + "column": 1 + }, + "help": "Rename the model." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/rule-unused-cte.json b/tests/goldens/compiler/failure/rule-unused-cte.json new file mode 100644 index 0000000000..7bf21cd0f3 --- /dev/null +++ b/tests/goldens/compiler/failure/rule-unused-cte.json @@ -0,0 +1,30 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "rule", + "severity": "error", + "code": "SQBRSQL005", + "message": "CTE is unreachable from the final query", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 6 + }, + "help": "Reference the CTE from the final query or another reachable CTE, or remove it.", + "notes": [ + "Fix available: `sqb format --fix` applies it after compiler verification" + ] + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/runtime-placeholder-without-default.json b/tests/goldens/compiler/failure/runtime-placeholder-without-default.json new file mode 100644 index 0000000000..c41ac30c26 --- /dev/null +++ b/tests/goldens/compiler/failure/runtime-placeholder-without-default.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "model 'stg_orders': @@@placeholders without default values in placeholders config: window_start" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scenario-check-reads-source.json b/tests/goldens/compiler/failure/scenario-check-reads-source.json new file mode 100644 index 0000000000..f262a45f84 --- /dev/null +++ b/tests/goldens/compiler/failure/scenario-check-reads-source.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL scenario file tests/scenarios/orders.sql CTE '__expected__stg_orders' must not reference project source 'raw_orders' with __source(); source-backed scenario data is only allowed in helper and fixture CTEs" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scenario-dependent-checks.json b/tests/goldens/compiler/failure/scenario-dependent-checks.json new file mode 100644 index 0000000000..e2564dc3e4 --- /dev/null +++ b/tests/goldens/compiler/failure/scenario-dependent-checks.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL scenario 'tests/scenarios/orders.sql' check CTE '__expected__stg_orders' must not depend on '__assert__no_rows'; expected results and assertions must be independent" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scenario-first-of-two-errors.json b/tests/goldens/compiler/failure/scenario-first-of-two-errors.json new file mode 100644 index 0000000000..10b8363fc0 --- /dev/null +++ b/tests/goldens/compiler/failure/scenario-first-of-two-errors.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL scenario 'tests/scenarios/a_orders.sql' must use __seed__ to identify a target" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scenario-fixture-without-target.json b/tests/goldens/compiler/failure/scenario-fixture-without-target.json new file mode 100644 index 0000000000..26fa2c8e66 --- /dev/null +++ b/tests/goldens/compiler/failure/scenario-fixture-without-target.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL scenario 'tests/scenarios/orders.sql' must use __seed__ to identify a target" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scenario-macro-mock.json b/tests/goldens/compiler/failure/scenario-macro-mock.json new file mode 100644 index 0000000000..0282822409 --- /dev/null +++ b/tests/goldens/compiler/failure/scenario-macro-mock.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL scenario 'tests/scenarios/orders.sql' does not support macro mock CTE '__macro__tidy'. Scenarios run real project macros; use SQL unit tests for macro mocks." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scenario-materialized-cte.json b/tests/goldens/compiler/failure/scenario-materialized-cte.json new file mode 100644 index 0000000000..0844e70d10 --- /dev/null +++ b/tests/goldens/compiler/failure/scenario-materialized-cte.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL scenario 'tests/scenarios/orders.sql' CTE '__source__raw_orders' must not use AS MATERIALIZED; materialization hints are not supported in SQL scenario CTEs\n --> tests/scenarios/orders.sql:6:25", + "help": "remove MATERIALIZED and write __source__raw_orders AS (...)" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scenario-parse.json b/tests/goldens/compiler/failure/scenario-parse.json new file mode 100644 index 0000000000..f9a2ec10b1 --- /dev/null +++ b/tests/goldens/compiler/failure/scenario-parse.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D009", + "message": "SQL scenario '/tests/scenarios/orders.sql' must start with a SCENARIO() header as the first non-whitespace content" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scenario-quoted-cte-name.json b/tests/goldens/compiler/failure/scenario-quoted-cte-name.json new file mode 100644 index 0000000000..909d3d072d --- /dev/null +++ b/tests/goldens/compiler/failure/scenario-quoted-cte-name.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL scenario 'tests/scenarios/orders.sql' CTE name \"__source__raw_orders\" must be an unquoted identifier of ASCII letters, digits and underscores\n --> tests/scenarios/orders.sql:6:1", + "help": "rename the CTE, for example __source__raw_orders; quoted CTE names and names with $ or non-ASCII characters are not supported" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scenario-statement-after-ctes.json b/tests/goldens/compiler/failure/scenario-statement-after-ctes.json new file mode 100644 index 0000000000..0a1890b46b --- /dev/null +++ b/tests/goldens/compiler/failure/scenario-statement-after-ctes.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL scenario 'tests/scenarios/orders.sql' must end after its CTEs; only an optional ceremonial top-level `SELECT 1` may follow them" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scenario-without-checks.json b/tests/goldens/compiler/failure/scenario-without-checks.json new file mode 100644 index 0000000000..b8f7ce9fe9 --- /dev/null +++ b/tests/goldens/compiler/failure/scenario-without-checks.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL scenario 'tests/scenarios/orders.sql' must define at least one __expected__ or __assert__ CTE" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/schema-from-sibling-folder.json b/tests/goldens/compiler/failure/schema-from-sibling-folder.json new file mode 100644 index 0000000000..fb5dc4d694 --- /dev/null +++ b/tests/goldens/compiler/failure/schema-from-sibling-folder.json @@ -0,0 +1,289 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "S006", + "message": "Schema 'order_shape' is not visible from 'models/staging/stg_orders.sql'. It is defined at models/marts/_sqlbuild/_schemas/order_shape.sql with local scope owned by 'models/marts'", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "help": "move 'models/marts/_sqlbuild/_schemas/order_shape.sql' to a schemas/ role owned by 'models/staging' or one of its parent folders, or to the project-wide schemas/ when consumers span resource trees" + }, + { + "phase": "compile", + "severity": "error", + "code": "S007", + "message": "Declaration 'schema:order_shape' is currently exact-owner-private at 'models/marts' (models/marts/_sqlbuild/_schemas/order_shape.sql); required exact-owner-private at 'models/staging'. Consumers: model:stg_orders. Move it to 'models/staging/_sqlbuild/_schemas/'", + "path": "models/marts/_sqlbuild/_schemas/order_shape.sql", + "line": 1, + "column": 1, + "location": { + "path": "models/marts/_sqlbuild/_schemas/order_shape.sql", + "line": 1, + "column": 1 + } + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/schema-unterminated-declaration.json b/tests/goldens/compiler/failure/schema-unterminated-declaration.json new file mode 100644 index 0000000000..82860340ab --- /dev/null +++ b/tests/goldens/compiler/failure/schema-unterminated-declaration.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "/models/staging/_sqlbuild/_schemas/orders.sql has an unterminated declaration header" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/schema-yml-invalid-yaml.json b/tests/goldens/compiler/failure/schema-yml-invalid-yaml.json new file mode 100644 index 0000000000..ae3dc287c4 --- /dev/null +++ b/tests/goldens/compiler/failure/schema-yml-invalid-yaml.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D005", + "message": "/models/marts/schema.yml contains invalid YAML at line 2, column 1: while parsing a node, did not find expected node content" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/schema-yml-model-metadata.json b/tests/goldens/compiler/failure/schema-yml-model-metadata.json new file mode 100644 index 0000000000..0d428b077f --- /dev/null +++ b/tests/goldens/compiler/failure/schema-yml-model-metadata.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D005", + "message": "/models/marts/schema.yml declares model metadata in 'models', but model metadata must live in the model file MODEL(...). Move description, columns, and audits into the model header." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scope-duplicate-scoped-enum.json b/tests/goldens/compiler/failure/scope-duplicate-scoped-enum.json new file mode 100644 index 0000000000..f0290603a8 --- /dev/null +++ b/tests/goldens/compiler/failure/scope-duplicate-scoped-enum.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Invalid declaration scope index:\n[S003] Duplicate declaration 'enum:staged_status' at enums/status.sql:1:1, models/staging/_enums/status.sql:1:1\n[S003] Duplicate declaration 'enum:staged_status' at enums/status.sql:1:1, models/staging/_enums/status.sql:1:1" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scope-first-of-two-visibility-errors.json b/tests/goldens/compiler/failure/scope-first-of-two-visibility-errors.json new file mode 100644 index 0000000000..e2a6fe7353 --- /dev/null +++ b/tests/goldens/compiler/failure/scope-first-of-two-visibility-errors.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Enum 'staged_status' is known but inaccessible in '/models/marts/customer_totals.sql'. It is defined at models/staging/_enums/status.sql:1:1 with local scope owned by 'models/staging'; consumer path: '/models/marts/customer_totals.sql'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scope-inaccessible-local-macro.json b/tests/goldens/compiler/failure/scope-inaccessible-local-macro.json new file mode 100644 index 0000000000..c6c2cda986 --- /dev/null +++ b/tests/goldens/compiler/failure/scope-inaccessible-local-macro.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Macro '@staged_amount' in '/models/marts/customer_totals.sql' is inaccessible. Defined at 'models/staging/_macros/amounts.py:1:1' with scope owner 'models/staging'; consumer/definition path is '/models/marts/customer_totals.sql'. Visible macros: none" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scope-macro-test-cte-without-body.json b/tests/goldens/compiler/failure/scope-macro-test-cte-without-body.json new file mode 100644 index 0000000000..0f1d66c006 --- /dev/null +++ b/tests/goldens/compiler/failure/scope-macro-test-cte-without-body.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL test 'tests/unit/test_customer_totals.sql' CTE '__macro_actual__' must use AS (...)" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scope-malformed-expected-relationship.json b/tests/goldens/compiler/failure/scope-malformed-expected-relationship.json new file mode 100644 index 0000000000..3bf3e6f32e --- /dev/null +++ b/tests/goldens/compiler/failure/scope-malformed-expected-relationship.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL test 'tests/unit/test_customer_totals.sql' must use __expected__ to identify a target" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scope-scenario-expected-without-target.json b/tests/goldens/compiler/failure/scope-scenario-expected-without-target.json new file mode 100644 index 0000000000..a423eb3db6 --- /dev/null +++ b/tests/goldens/compiler/failure/scope-scenario-expected-without-target.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL scenario 'tests/scenarios/orders.sql' must use __expected__ to identify a target" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scope-test-outside-relationship-grant.json b/tests/goldens/compiler/failure/scope-test-outside-relationship-grant.json new file mode 100644 index 0000000000..c0fdc3f0d4 --- /dev/null +++ b/tests/goldens/compiler/failure/scope-test-outside-relationship-grant.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Enum 'staged_status' is known but inaccessible in '/tests/unit/test_customer_totals.sql'. It is defined at models/staging/_enums/status.sql:1:1 with local scope owned by 'models/staging'; consumer path: '/tests/unit/test_customer_totals.sql'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/scoped-root-at-project-root.json b/tests/goldens/compiler/failure/scoped-root-at-project-root.json new file mode 100644 index 0000000000..a2b71957ba --- /dev/null +++ b/tests/goldens/compiler/failure/scoped-root-at-project-root.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D013", + "message": "Scoped declaration root _enums/ must be below a canonical authored root" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/seed-declaration-without-csv.json b/tests/goldens/compiler/failure/seed-declaration-without-csv.json new file mode 100644 index 0000000000..8eb1c9b5d2 --- /dev/null +++ b/tests/goldens/compiler/failure/seed-declaration-without-csv.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D008", + "message": "Seed declaration 'order_channels' in seeds/order_channels.yml has no matching CSV file under seeds/" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/seed-header-mismatch.json b/tests/goldens/compiler/failure/seed-header-mismatch.json new file mode 100644 index 0000000000..d333066a74 --- /dev/null +++ b/tests/goldens/compiler/failure/seed-header-mismatch.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D008", + "message": "seeds/order_channels.csv header ('id', 'name') does not match declared seed columns ('id', 'label') for 'order_channels'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/seed-without-header.json b/tests/goldens/compiler/failure/seed-without-header.json new file mode 100644 index 0000000000..323aeb2ead --- /dev/null +++ b/tests/goldens/compiler/failure/seed-without-header.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D008", + "message": "Seed CSV seeds/lookups.csv has no matching declaration for seed 'lookups' under seeds/**/*.yml" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/seed-yaml-extension.json b/tests/goldens/compiler/failure/seed-yaml-extension.json new file mode 100644 index 0000000000..57cedec1d4 --- /dev/null +++ b/tests/goldens/compiler/failure/seed-yaml-extension.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D005", + "message": "Seed declaration file seeds/order_channels.yaml must use .yml; .yaml is not supported" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/semantic-cursor-inputs-unknown-column.json b/tests/goldens/compiler/failure/semantic-cursor-inputs-unknown-column.json new file mode 100644 index 0000000000..ea2df9429b --- /dev/null +++ b/tests/goldens/compiler/failure/semantic-cursor-inputs-unknown-column.json @@ -0,0 +1,274 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B300", + "message": "cursor_inputs stg_orders references unknown column 'placed_at'", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 9, + "column": 16, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 9, + "column": 16 + }, + "help": "change the metadata column name to an existing output column" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "customer_id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/semantic-qualified-alias-unknown-column.json b/tests/goldens/compiler/failure/semantic-qualified-alias-unknown-column.json new file mode 100644 index 0000000000..662ed8627a --- /dev/null +++ b/tests/goldens/compiler/failure/semantic-qualified-alias-unknown-column.json @@ -0,0 +1,277 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "Unknown column 'amonut' in stg_orders (as o)", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 29, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 29, + "end_line": 5, + "end_column": 35 + }, + "help": "did you mean 'amount'?", + "notes": [ + "stg_orders has: amount, status, customer_id, order_id" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT o.customer_id, SUM(o.amonut) AS total_amount", + "FROM __ref(\"stg_orders\") AS o", + "GROUP BY o.customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/semantic-recovered-downstream-uses.json b/tests/goldens/compiler/failure/semantic-recovered-downstream-uses.json new file mode 100644 index 0000000000..6a894d3e8f --- /dev/null +++ b/tests/goldens/compiler/failure/semantic-recovered-downstream-uses.json @@ -0,0 +1,278 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "Unknown column 'amonut' in raw_orders", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "line": 5, + "column": 31, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 5, + "column": 31, + "end_line": 5, + "end_column": 37 + }, + "help": "did you mean 'amount'?", + "notes": [ + "raw_orders has: amount, status, customer_id, order_id", + "1 downstream uses of stg_orders.amount were not checked because of this error" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amonut, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/semantic-rejected-opt-out-counts-findings.json b/tests/goldens/compiler/failure/semantic-rejected-opt-out-counts-findings.json new file mode 100644 index 0000000000..588ae44763 --- /dev/null +++ b/tests/goldens/compiler/failure/semantic-rejected-opt-out-counts-findings.json @@ -0,0 +1,276 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P009", + "message": "`sql_analysis false` is not needed for model 'customer_totals'", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 3, + "column": 3, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 3, + "column": 3 + }, + "help": "remove `sql_analysis false` and fix the findings it was hiding: 2 unknown columns, 1 type mismatch (run `sqb compile` to see them)\n = help: to allow `sql_analysis false` on any model, SQL test or audit, set this in sqlbuild_project.toml:\n [settings]\n require_sql_analysis = false", + "notes": [ + "sqlbuild_project.toml sets [settings] require_sql_analysis = true, which only allows `sql_analysis false` on SQL that SQLBuild cannot parse; this model parses successfully." + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(refund) AS total_amount, MAX(amonut) AS top_amount", + "FROM __ref(\"stg_orders\")", + "WHERE status > 5", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/semantic-source-cursor-unknown-column.json b/tests/goldens/compiler/failure/semantic-source-cursor-unknown-column.json new file mode 100644 index 0000000000..112420a01c --- /dev/null +++ b/tests/goldens/compiler/failure/semantic-source-cursor-unknown-column.json @@ -0,0 +1,330 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B300", + "message": "cursor_column references unknown column 'loaded_at'", + "resource_type": "source", + "resource_name": "raw_events", + "path": "sources/raw.yml", + "line": 21, + "column": 20, + "location": { + "path": "sources/raw.yml", + "line": 21, + "column": 20 + }, + "help": "change the metadata column name to an existing output column" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.failure_corpus.raw_events": { + "database": null, + "schema": "", + "name": "raw_events", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_events", + "fqn": [ + "failure_corpus", + "raw_events" + ], + "source_name": "raw_events", + "source_description": "", + "loader": "", + "identifier": "raw_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Loaded events.", + "columns": { + "event_id": { + "name": "event_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "load_seq": { + "name": "load_seq", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "raw_events", + "auto_load": false, + "write_strategy": "append", + "cursor_column": "loaded_at" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [], + "source.failure_corpus.raw_events": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/semantic-temporal-comparison-help.json b/tests/goldens/compiler/failure/semantic-temporal-comparison-help.json new file mode 100644 index 0000000000..877af0724a --- /dev/null +++ b/tests/goldens/compiler/failure/semantic-temporal-comparison-help.json @@ -0,0 +1,278 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B217", + "message": "Incompatible comparison between TIMESTAMP and INTEGER", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 7, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 7, + "column": 7, + "end_line": 7, + "end_column": 23 + }, + "help": "compare with a timestamp, for example TIMESTAMP '2026-04-01'", + "notes": [ + "o.ordered_at is TIMESTAMP, 5 is INTEGER" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT o.customer_id, SUM(o.amount) AS total_amount", + "FROM __ref(\"stg_orders\") AS o", + "WHERE o.ordered_at > 5", + "GROUP BY o.customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status, CAST('2026-01-01' AS TIMESTAMP) AS ordered_at", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/semantic-type-error-unchecked-uses.json b/tests/goldens/compiler/failure/semantic-type-error-unchecked-uses.json new file mode 100644 index 0000000000..6b3daf288b --- /dev/null +++ b/tests/goldens/compiler/failure/semantic-type-error-unchecked-uses.json @@ -0,0 +1,278 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B212", + "message": "Arithmetic operation expects NUMERIC-compatible operands, found STRING and INTEGER", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "line": 5, + "column": 31, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 5, + "column": 31, + "end_line": 5, + "end_column": 41 + }, + "help": "use operands supported by this arithmetic operator, or convert them explicitly", + "notes": [ + "1 downstream output uses were not type-checked because of this error", + "status is TEXT, 1 is INTEGER" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, status + 1 AS amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/semantic-udf-qualified-cast-argument-family.json b/tests/goldens/compiler/failure/semantic-udf-qualified-cast-argument-family.json new file mode 100644 index 0000000000..591093f15e --- /dev/null +++ b/tests/goldens/compiler/failure/semantic-udf-qualified-cast-argument-family.json @@ -0,0 +1,281 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B301", + "message": "Function 'scaled_amount' argument 'p_factor' expects INTEGER, received TEXT; convert the argument explicitly", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 10, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 10 + }, + "help": "align this declared metadata or audit value with the column or argument type" + } + ] + } + ], + "compiled": { + "functions/sql/scaled_amount.sql": [ + "CREATE OR REPLACE MACRO main.scaled_amount(p_amount, p_factor) AS (", + "p_amount * p_factor", + ")", + "" + ], + "models/marts/customer_totals.sql": [ + "SELECT o.customer_id,", + " __udf(\"scaled_amount\")(o.amount, CAST(o.status AS VARCHAR)) AS total_amount", + "FROM __ref(\"stg_orders\") AS o", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.scaled_amount", + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.scaled_amount", + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [], + "model.failure_corpus.scaled_amount": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/set-operation-width.json b/tests/goldens/compiler/failure/set-operation-width.json new file mode 100644 index 0000000000..216edb4671 --- /dev/null +++ b/tests/goldens/compiler/failure/set-operation-width.json @@ -0,0 +1,272 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B216", + "message": "UNION operands return different column counts: left 2, right 1", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 1, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 1 + }, + "help": "return the same number of columns on both sides of this operation" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, amount FROM __ref(\"stg_orders\")", + "UNION ALL", + "SELECT customer_id FROM __ref(\"stg_orders\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/single-quoted-source-name.json b/tests/goldens/compiler/failure/single-quoted-source-name.json new file mode 100644 index 0000000000..85819900ef --- /dev/null +++ b/tests/goldens/compiler/failure/single-quoted-source-name.json @@ -0,0 +1,270 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__source('raw_orders') is not a valid __source() call", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 28 + }, + "help": "__source() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __source(\"raw_orders\")" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source('raw_orders')", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/singular-audit-across-trees.json b/tests/goldens/compiler/failure/singular-audit-across-trees.json new file mode 100644 index 0000000000..0609e7b219 --- /dev/null +++ b/tests/goldens/compiler/failure/singular-audit-across-trees.json @@ -0,0 +1,278 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "S009", + "message": "Declaration 'singular_audit:totals_have_orders' is currently descendant-public at 'models/marts' (models/marts/_sqlbuild/audits/singular/totals_have_orders.sql); required project at 'top-level root'. References: model:customer_totals, source:raw_orders. Move it to 'top-level audits/singular/'", + "resource_type": "audit", + "resource_name": "totals_have_orders", + "path": "models/marts/_sqlbuild/audits/singular/totals_have_orders.sql", + "line": 1, + "column": 1, + "location": { + "path": "models/marts/_sqlbuild/audits/singular/totals_have_orders.sql", + "line": 1, + "column": 1 + } + } + ] + } + ], + "compiled": { + "audits/singular/totals_have_orders.sql": [ + "SELECT t.customer_id", + "FROM __ref(\"customer_totals\") t", + "LEFT JOIN __source(\"raw_orders\") o ON t.customer_id = o.customer_id", + "WHERE o.customer_id IS NULL", + "" + ], + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/singular-audit-one-resource.json b/tests/goldens/compiler/failure/singular-audit-one-resource.json new file mode 100644 index 0000000000..0985d3bfad --- /dev/null +++ b/tests/goldens/compiler/failure/singular-audit-one-resource.json @@ -0,0 +1,269 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P004", + "message": "Singular audit 'positive_totals' in models/marts/_sqlbuild/audits/singular/positive_totals.sql checks only model 'customer_totals'; singular audits must be cross-resource", + "resource_type": "audit", + "resource_name": "positive_totals", + "path": "models/marts/_sqlbuild/audits/singular/positive_totals.sql", + "help": "attach a generic audit to 'customer_totals' instead: write it in an audits/generic/ role and select FROM @relation, joining @relation to itself for self-join checks" + } + ] + } + ], + "compiled": { + "audits/singular/positive_totals.sql": [ + "SELECT customer_id FROM __ref(\"customer_totals\") WHERE total_amount < 0", + "" + ], + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/snapshot-schema-change-with-contract.json b/tests/goldens/compiler/failure/snapshot-schema-change-with-contract.json new file mode 100644 index 0000000000..c602ead729 --- /dev/null +++ b/tests/goldens/compiler/failure/snapshot-schema-change-with-contract.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "K012", + "message": "model 'stg_orders': snapshot_schema_change=append_new_columns is not valid with contract enforced; add new columns to the contract or set contract none" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/source-description-unknown-variable.json b/tests/goldens/compiler/failure/source-description-unknown-variable.json new file mode 100644 index 0000000000..ee3bfbff1d --- /dev/null +++ b/tests/goldens/compiler/failure/source-description-unknown-variable.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "source raw_orders description references unknown variable 'channel'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/source-parse.json b/tests/goldens/compiler/failure/source-parse.json new file mode 100644 index 0000000000..905f62d103 --- /dev/null +++ b/tests/goldens/compiler/failure/source-parse.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D006", + "message": "/sources/raw.yml contains invalid YAML at line 4, column 1: while parsing a node, did not find expected node content" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/source-unknown-key.json b/tests/goldens/compiler/failure/source-unknown-key.json new file mode 100644 index 0000000000..b458236a1f --- /dev/null +++ b/tests/goldens/compiler/failure/source-unknown-key.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D006", + "message": "/sources/raw.yml source has unknown keys: freshnes; allowed keys: audits, columns, contract, cursor_column, database, description, expression, freshness, ingestr, load_batch_size, managed, meta, name, schema, table, type_enforcement, unique_key, write_strategy", + "help": "did you mean 'freshness'?" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/source-unsupported-yaml.json b/tests/goldens/compiler/failure/source-unsupported-yaml.json new file mode 100644 index 0000000000..76820a2e86 --- /dev/null +++ b/tests/goldens/compiler/failure/source-unsupported-yaml.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D006", + "message": "/sources/raw.yml uses YAML that SQLBuild does not support at line 17, column 22: values tagged !!binary", + "help": "SQLBuild reads plain YAML: block and flow mappings and sequences, plain and quoted scalars, literal and folded block scalars, anchors, aliases and merge keys. Rewrite this part in one of those forms." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/sql-function-header.json b/tests/goldens/compiler/failure/sql-function-header.json new file mode 100644 index 0000000000..4b0cd22780 --- /dev/null +++ b/tests/goldens/compiler/failure/sql-function-header.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D002", + "message": "FUNCTION(...) in '/functions/sql/is_placed.sql' contains invalid SQLBuild header syntax: expected value at position 42" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/sql-function-missing-returns.json b/tests/goldens/compiler/failure/sql-function-missing-returns.json new file mode 100644 index 0000000000..56078e96cd --- /dev/null +++ b/tests/goldens/compiler/failure/sql-function-missing-returns.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL function file functions/sql/order_label.sql must declare returns" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/sql-function-template-namespace.json b/tests/goldens/compiler/failure/sql-function-template-namespace.json new file mode 100644 index 0000000000..a245f00d16 --- /dev/null +++ b/tests/goldens/compiler/failure/sql-function-template-namespace.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL function functions/sql/order_label.sql returns references unsupported template namespace 'VAR'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/sql-hook-unknown-key.json b/tests/goldens/compiler/failure/sql-hook-unknown-key.json new file mode 100644 index 0000000000..2911434d9e --- /dev/null +++ b/tests/goldens/compiler/failure/sql-hook-unknown-key.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D014", + "message": "HOOK() in '/hooks/sql/record_refresh.sql:3' has unsupported keys: phase", + "help": "supported keys: description" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/sql-test-glue-inverted-window.json b/tests/goldens/compiler/failure/sql-test-glue-inverted-window.json new file mode 100644 index 0000000000..f4752ebca8 --- /dev/null +++ b/tests/goldens/compiler/failure/sql-test-glue-inverted-window.json @@ -0,0 +1,36 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL test 'inverted_window' in 'tests/unit/test_customer_totals.sql': cursor_start '20' must be before the exclusive cursor_end '10' for model 'windowed_orders'" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/marts/windowed_orders.sql": [ + "SELECT order_id, amount", + "FROM __source(\"raw_orders\")", + "WHERE order_id >= __cursor_start() AND order_id < __cursor_end()", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/sql-test-glue-missing-mock.json b/tests/goldens/compiler/failure/sql-test-glue-missing-mock.json new file mode 100644 index 0000000000..b271f44a27 --- /dev/null +++ b/tests/goldens/compiler/failure/sql-test-glue-missing-mock.json @@ -0,0 +1,280 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "test", + "severity": "error", + "code": "S000", + "message": "test 'totals_without_source': model 'stg_orders' references __source(\"raw_orders\") which has no mock", + "resource_type": "sql_test", + "resource_name": "totals_without_source", + "path": "tests/unit/test_customer_totals.sql" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ], + "tests/_chain_/customer_totals__stg_orders/totals_without_source.sql": [ + "WITH __ref__stg_orders AS (SELECT 10 AS customer_id, 5.0 AS amount),", + "__ref__customer_totals AS (SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref__stg_orders", + "GROUP BY customer_id),", + "__sqb_cte_0 AS (SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")),", + "__actual__customer_totals AS (SELECT * FROM __ref__customer_totals),", + "__expected__customer_totals AS (SELECT 10 AS customer_id, 5.0 AS total_amount),", + "__actual__stg_orders AS (SELECT * FROM __sqb_cte_0),", + "__expected__stg_orders AS (SELECT 10 AS customer_id, 5.0 AS amount)", + "SELECT 0 AS step_index, 'customer_totals' AS model_name, (SELECT COUNT(*) FROM __actual__customer_totals) AS actual_count, (SELECT COUNT(*) FROM __expected__customer_totals) AS expected_count, (SELECT COUNT(*) FROM (SELECT customer_id, total_amount FROM __actual__customer_totals EXCEPT SELECT customer_id, total_amount FROM __expected__customer_totals) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT customer_id, total_amount FROM __expected__customer_totals EXCEPT SELECT customer_id, total_amount FROM __actual__customer_totals) AS __sqlbuild_missing) AS missing_count", + "UNION ALL", + "SELECT 1 AS step_index, 'stg_orders' AS model_name, (SELECT COUNT(*) FROM __actual__stg_orders) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_orders) AS expected_count, (SELECT COUNT(*) FROM (SELECT customer_id, amount FROM __actual__stg_orders EXCEPT SELECT customer_id, amount FROM __expected__stg_orders) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT customer_id, amount FROM __expected__stg_orders EXCEPT SELECT customer_id, amount FROM __actual__stg_orders) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/sql-test-glue-window-without-cursor-model.json b/tests/goldens/compiler/failure/sql-test-glue-window-without-cursor-model.json new file mode 100644 index 0000000000..2b0c5b3c1f --- /dev/null +++ b/tests/goldens/compiler/failure/sql-test-glue-window-without-cursor-model.json @@ -0,0 +1,30 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL test 'plain_window' in 'tests/unit/test_customer_totals.sql' declares cursor_start or cursor_end, but no model it evaluates uses __cursor_start() or __cursor_end()" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/syntax-function.json b/tests/goldens/compiler/failure/syntax-function.json new file mode 100644 index 0000000000..b6ddf7cd24 --- /dev/null +++ b/tests/goldens/compiler/failure/syntax-function.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL syntax error in function 'scaled_amount' (/functions/sql/scaled_amount.sql): Parse error at line 1, column 21: Expected RParen, got end of input ('') near [* (p_factor]", + "help": "if this SQL is valid for your warehouse, please report it so the parser can support it\n = help: SQL analysis is on for this project; to turn it off for every model, set this in sqlbuild_project.toml:\n [settings]\n sql_analysis = false\n = help: to skip SQL analysis for one run, use `--no-sql-analysis`" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/syntax-hook.json b/tests/goldens/compiler/failure/syntax-hook.json new file mode 100644 index 0000000000..d8ab5bfc26 --- /dev/null +++ b/tests/goldens/compiler/failure/syntax-hook.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Polyglot could not parse model 'customer_totals' post_hooks[0] sql(\"record_refresh\") (hooks/sql/record_refresh.sql): Expected table name or subquery, got Where", + "help": "if this SQL is valid for your warehouse, skip SQL analysis for this model, add this to the MODEL header:\n MODEL (\n sql_analysis false,\n ...\n );\n and please report the SQL so the parser can support it\n = help: SQL analysis is on for this project; to turn it off for every model, set this in sqlbuild_project.toml:\n [settings]\n sql_analysis = false\n = help: to skip SQL analysis for one run, use `--no-sql-analysis`" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/syntax-inline-hook.json b/tests/goldens/compiler/failure/syntax-inline-hook.json new file mode 100644 index 0000000000..1a52b36985 --- /dev/null +++ b/tests/goldens/compiler/failure/syntax-inline-hook.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Polyglot could not parse model 'customer_totals' post_hooks[0] inline_sql(\"...\") (/models/marts/customer_totals.sql): Expected table name or subquery, got Where", + "help": "if this SQL is valid for your warehouse, skip SQL analysis for this model, add this to the MODEL header:\n MODEL (\n sql_analysis false,\n ...\n );\n and please report the SQL so the parser can support it\n = help: SQL analysis is on for this project; to turn it off for every model, set this in sqlbuild_project.toml:\n [settings]\n sql_analysis = false\n = help: to skip SQL analysis for one run, use `--no-sql-analysis`" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/syntax-source-expression.json b/tests/goldens/compiler/failure/syntax-source-expression.json new file mode 100644 index 0000000000..e336422be3 --- /dev/null +++ b/tests/goldens/compiler/failure/syntax-source-expression.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL syntax error in source expression 'raw_orders' (/sources/raw.yml): Parse error at line 1, column 38: Unexpected token: Comma", + "help": "if this SQL is valid for your warehouse, please report it so the parser can support it\n = help: SQL analysis is on for this project; to turn it off for every model, set this in sqlbuild_project.toml:\n [settings]\n sql_analysis = false\n = help: to skip SQL analysis for one run, use `--no-sql-analysis`" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/table-function-arity.json b/tests/goldens/compiler/failure/table-function-arity.json new file mode 100644 index 0000000000..22621bb4fa --- /dev/null +++ b/tests/goldens/compiler/failure/table-function-arity.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Model file models/marts/customer_totals.sql table function 'table_fn__orders_for' expects 1 argument but received 2" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/table-function-empty-call-argument.json b/tests/goldens/compiler/failure/table-function-empty-call-argument.json new file mode 100644 index 0000000000..946df88075 --- /dev/null +++ b/tests/goldens/compiler/failure/table-function-empty-call-argument.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/marts/customer_totals.sql:6:6: SQL reference contains an empty argument" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/table-function-single-quoted-name.json b/tests/goldens/compiler/failure/table-function-single-quoted-name.json new file mode 100644 index 0000000000..9b0b2aaa4e --- /dev/null +++ b/tests/goldens/compiler/failure/table-function-single-quoted-name.json @@ -0,0 +1,269 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__table_fn('table_fn__orders_for') is not a valid __table_fn() call", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 40 + }, + "help": "__table_fn() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __table_fn(\"table_fn__orders_for\")(...)" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT order_id AS customer_id, 1 AS total_amount", + "FROM __table_fn('table_fn__orders_for')(1)", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/table-function-unclosed-call.json b/tests/goldens/compiler/failure/table-function-unclosed-call.json new file mode 100644 index 0000000000..233c2dadd1 --- /dev/null +++ b/tests/goldens/compiler/failure/table-function-unclosed-call.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "models/marts/customer_totals.sql:6:6: SQL table function call contains an unclosed parenthesis" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/table-function-without-arguments.json b/tests/goldens/compiler/failure/table-function-without-arguments.json new file mode 100644 index 0000000000..8ce7a7e6a3 --- /dev/null +++ b/tests/goldens/compiler/failure/table-function-without-arguments.json @@ -0,0 +1,269 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__table_fn must be followed by an argument list", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 40 + }, + "help": "pass the function arguments in a second set of parentheses, using () for no arguments: __table_fn(\"table_fn__orders_for\")()" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT order_id AS customer_id, 1 AS total_amount", + "FROM __table_fn(\"table_fn__orders_for\") /* no call */", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/target-managed-loader-collision.json b/tests/goldens/compiler/failure/target-managed-loader-collision.json new file mode 100644 index 0000000000..0d0215bd07 --- /dev/null +++ b/tests/goldens/compiler/failure/target-managed-loader-collision.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "S102", + "message": "Managed loader write collision: targets 'dev' and 'prod' both resolve to database='failure.duckdb' schema='raw'. Set distinct targets.dev.loader_schema and targets.prod.loader_schema values." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/target-missing-database.json b/tests/goldens/compiler/failure/target-missing-database.json new file mode 100644 index 0000000000..3fce7f186c --- /dev/null +++ b/tests/goldens/compiler/failure/target-missing-database.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "S101", + "message": "snowflake execution requires explicit target database. model 'customer_totals' resolved to database=None schema='ANALYTICS'. Set them in the model config, the environment config, or the project defaults.", + "help": "to set project-wide defaults, set this in sqlbuild_project.toml:\n [defaults]\n database = \"my_database\"" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/target-missing-write-schema.json b/tests/goldens/compiler/failure/target-missing-write-schema.json new file mode 100644 index 0000000000..dc9dd0833a --- /dev/null +++ b/tests/goldens/compiler/failure/target-missing-write-schema.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "S103", + "message": "Model 'customer_totals' has no explicitly resolved physical write schema. Set schema on the resource or its defaults, selected target, loader_schema, or connection." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/target-named-without-schema.json b/tests/goldens/compiler/failure/target-named-without-schema.json new file mode 100644 index 0000000000..f256f489be --- /dev/null +++ b/tests/goldens/compiler/failure/target-named-without-schema.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "S104", + "message": "Named target 'dev' must explicitly set schema to a nonblank literal or 'preserve'. Resource schemas, defaults, and connection schemas do not select a named target schema strategy." + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/target-unknown-key.json b/tests/goldens/compiler/failure/target-unknown-key.json new file mode 100644 index 0000000000..238270d0ba --- /dev/null +++ b/tests/goldens/compiler/failure/target-unknown-key.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D001", + "message": "/sqlbuild_project.toml targets.ci contains unknown key(s): warehouse_size. Allowed keys: clone, compile_cache, connection, database, default_table_type, defer_clone_from, defer_sources_to, diff, execution_limits, loader_schema, missing_migration_origin, owns_time_travel_retention_namespace, schema, table_type_downgrade, time_travel_retention, time_travel_retention_decrease, vars, warehouses", + "help": "did you mean 'warehouses'?" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/test-assertion-reads-unmocked-source.json b/tests/goldens/compiler/failure/test-assertion-reads-unmocked-source.json new file mode 100644 index 0000000000..0d989d6ad8 --- /dev/null +++ b/tests/goldens/compiler/failure/test-assertion-reads-unmocked-source.json @@ -0,0 +1,274 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P013", + "message": "SQL test assertion CTE '__assert__no_negative_orders' calls __source(\"raw_orders\"), which the test does not mock, so the test query cannot resolve it", + "resource_type": "sql_test", + "resource_name": "test_customer_totals", + "path": "tests/unit/test_customer_totals.sql", + "line": 11, + "column": 24, + "location": { + "path": "tests/unit/test_customer_totals.sql", + "line": 11, + "column": 24, + "end_line": 11, + "end_column": 46 + }, + "help": "Mock it in the test, for example __source__raw_orders AS (SELECT ...), or remove the call from assertion CTE '__assert__no_negative_orders'." + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/test-case-missing-parameter.json b/tests/goldens/compiler/failure/test-case-missing-parameter.json new file mode 100644 index 0000000000..36f1373446 --- /dev/null +++ b/tests/goldens/compiler/failure/test-case-missing-parameter.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D003", + "message": "TEST() case 'placed' in '/tests/unit/test_order_cases.sql' is missing parameters: amount_value" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/test-expected-implicit-alias.json b/tests/goldens/compiler/failure/test-expected-implicit-alias.json new file mode 100644 index 0000000000..29a4c61e16 --- /dev/null +++ b/tests/goldens/compiler/failure/test-expected-implicit-alias.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL test 'tests/unit/test_stg_orders.sql' must alias every non-trivial __expected__stg_orders projection", + "help": "name the column with an alias, for example amount IS NULL AS ; only a bare or qualified column reference may go unaliased" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/test-expected-parenthesised-branch.json b/tests/goldens/compiler/failure/test-expected-parenthesised-branch.json new file mode 100644 index 0000000000..a777cb689c --- /dev/null +++ b/tests/goldens/compiler/failure/test-expected-parenthesised-branch.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL test 'tests/unit/test_stg_orders.sql' must write each __expected__stg_orders set-operation branch as a plain SELECT without enclosing parentheses" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/test-expected-reads-unknown-model.json b/tests/goldens/compiler/failure/test-expected-reads-unknown-model.json new file mode 100644 index 0000000000..fabb28be9c --- /dev/null +++ b/tests/goldens/compiler/failure/test-expected-reads-unknown-model.json @@ -0,0 +1,274 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P013", + "message": "SQL test expected CTE '__expected__stg_orders' references unknown model 'archived_orders'", + "resource_type": "sql_test", + "resource_name": "test_stg_orders", + "path": "tests/unit/test_stg_orders.sql", + "line": 8, + "column": 24, + "location": { + "path": "tests/unit/test_stg_orders.sql", + "line": 8, + "column": 24, + "end_line": 8, + "end_column": 48 + }, + "help": "Read a model defined in the project, for example __ref(\"\"), or remove the reference from expected CTE '__expected__stg_orders'." + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/test-expected-unknown-column.json b/tests/goldens/compiler/failure/test-expected-unknown-column.json new file mode 100644 index 0000000000..c1e0924657 --- /dev/null +++ b/tests/goldens/compiler/failure/test-expected-unknown-column.json @@ -0,0 +1,283 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B302", + "message": "SQL test '__expected__stg_orders' names unknown column 'discount'", + "resource_type": "sql_test", + "resource_name": "test_stg_orders", + "path": "tests/unit/test_stg_orders.sql", + "line": 8, + "column": 30, + "location": { + "path": "tests/unit/test_stg_orders.sql", + "line": 8, + "column": 30, + "end_line": 8, + "end_column": 38 + }, + "help": "align the SQL-test fixture or expected columns with the tested resource's output" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ], + "tests/stg_orders/test_stg_orders.sql": [ + "WITH __source__raw_orders AS (SELECT 1 AS order_id, 10 AS customer_id, CAST(5 AS DOUBLE) AS amount, 'placed' AS status),", + "__ref__stg_orders AS (SELECT order_id, customer_id, amount, status", + "FROM __source__raw_orders),", + "__actual__stg_orders AS (SELECT * FROM __ref__stg_orders),", + "__expected__stg_orders AS (SELECT 1 AS order_id, 2 AS discount)", + "SELECT 0 AS step_index, 'stg_orders' AS model_name, (SELECT COUNT(*) FROM __actual__stg_orders) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_orders) AS expected_count, (SELECT COUNT(*) FROM (SELECT order_id, discount FROM __actual__stg_orders EXCEPT SELECT order_id, discount FROM __expected__stg_orders) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT order_id, discount FROM __expected__stg_orders EXCEPT SELECT order_id, discount FROM __actual__stg_orders) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/test-expects-unknown-model.json b/tests/goldens/compiler/failure/test-expects-unknown-model.json new file mode 100644 index 0000000000..b39f388d2b --- /dev/null +++ b/tests/goldens/compiler/failure/test-expects-unknown-model.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL test file tests/unit/test_stg_payments.sql expects unknown model 'stg_payments'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/test-helper-reads-unknown-model.json b/tests/goldens/compiler/failure/test-helper-reads-unknown-model.json new file mode 100644 index 0000000000..be0c3d62df --- /dev/null +++ b/tests/goldens/compiler/failure/test-helper-reads-unknown-model.json @@ -0,0 +1,274 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P013", + "message": "SQL test helper CTE 'archived_orders' references unknown model 'archived_orders'", + "resource_type": "sql_test", + "resource_name": "test_stg_orders", + "path": "tests/unit/test_stg_orders.sql", + "line": 8, + "column": 24, + "location": { + "path": "tests/unit/test_stg_orders.sql", + "line": 8, + "column": 24, + "end_line": 8, + "end_column": 48 + }, + "help": "Read a model defined in the project, for example __ref(\"\"), or remove the reference from helper CTE 'archived_orders'." + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/test-mocks-unknown-source.json b/tests/goldens/compiler/failure/test-mocks-unknown-source.json new file mode 100644 index 0000000000..fb0c37c930 --- /dev/null +++ b/tests/goldens/compiler/failure/test-mocks-unknown-source.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL test file tests/unit/test_stg_orders.sql mocks unknown source 'raw_payments'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/test-parse.json b/tests/goldens/compiler/failure/test-parse.json new file mode 100644 index 0000000000..868397b0a6 --- /dev/null +++ b/tests/goldens/compiler/failure/test-parse.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D003", + "message": "SQL test '/tests/unit/test_stg_orders.sql' must start with a TEST() header as the first non-whitespace content" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/test-quoted-cte-name.json b/tests/goldens/compiler/failure/test-quoted-cte-name.json new file mode 100644 index 0000000000..0fa006a626 --- /dev/null +++ b/tests/goldens/compiler/failure/test-quoted-cte-name.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL test 'tests/unit/test_stg_orders.sql' CTE name \"recent orders\" must be an unquoted identifier of ASCII letters, digits and underscores\n --> tests/unit/test_stg_orders.sql:7:1", + "help": "rename the CTE, for example recent_orders; quoted CTE names and names with $ or non-ASCII characters are not supported" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/test-reads-only-mocks.json b/tests/goldens/compiler/failure/test-reads-only-mocks.json new file mode 100644 index 0000000000..d91fc257f0 --- /dev/null +++ b/tests/goldens/compiler/failure/test-reads-only-mocks.json @@ -0,0 +1,274 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P013", + "message": "SQL test 'test_stg_orders' mocks the model it tests (__ref__stg_orders), so the test has no model to run against", + "resource_type": "sql_test", + "resource_name": "test_stg_orders", + "path": "tests/unit/test_stg_orders.sql", + "line": 8, + "column": 24, + "location": { + "path": "tests/unit/test_stg_orders.sql", + "line": 8, + "column": 24, + "end_line": 8, + "end_column": 43 + }, + "help": "Mock the model's inputs instead (for example __source__ or __ref__) and keep __ref(\"stg_orders\") in the __assert__ or __expected__ CTE, or remove the test." + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/unclosed-dollar-quote-with-project-variable.json b/tests/goldens/compiler/failure/unclosed-dollar-quote-with-project-variable.json new file mode 100644 index 0000000000..a9e5ec93cd --- /dev/null +++ b/tests/goldens/compiler/failure/unclosed-dollar-quote-with-project-variable.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "SQL interpolation contains an unclosed quoted string" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/ungrouped-column.json b/tests/goldens/compiler/failure/ungrouped-column.json new file mode 100644 index 0000000000..7c623a89c5 --- /dev/null +++ b/tests/goldens/compiler/failure/ungrouped-column.json @@ -0,0 +1,274 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B230", + "message": "Column must be grouped or used in an aggregate function", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 21, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 21, + "end_line": 5, + "end_column": 27 + }, + "help": "add this expression to GROUP BY or use it inside an aggregate" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, status, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/unknown-column.json b/tests/goldens/compiler/failure/unknown-column.json new file mode 100644 index 0000000000..3a592e9c09 --- /dev/null +++ b/tests/goldens/compiler/failure/unknown-column.json @@ -0,0 +1,276 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "B002", + "message": "Unknown column 'discount' in stg_orders", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 25, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 5, + "column": 25, + "end_line": 5, + "end_column": 33 + }, + "notes": [ + "stg_orders has: amount, customer_id, status, order_id" + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(discount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/unknown-constant.json b/tests/goldens/compiler/failure/unknown-constant.json new file mode 100644 index 0000000000..5c030968f4 --- /dev/null +++ b/tests/goldens/compiler/failure/unknown-constant.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Unknown constant 'minimum_amount' in '/models/staging/stg_orders.sql'. Visible constants: none" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/unknown-enum-member.json b/tests/goldens/compiler/failure/unknown-enum-member.json new file mode 100644 index 0000000000..893223e5ee --- /dev/null +++ b/tests/goldens/compiler/failure/unknown-enum-member.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Unknown member 'RETURNED' for enum 'order_status' in '/models/staging/stg_orders.sql'. Available members: PLACED, SHIPPED" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/unknown-macro.json b/tests/goldens/compiler/failure/unknown-macro.json new file mode 100644 index 0000000000..adbe60f253 --- /dev/null +++ b/tests/goldens/compiler/failure/unknown-macro.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Unknown macro '@cents' in '/models/staging/stg_orders.sql'. Available macros: none" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/unknown-ref.json b/tests/goldens/compiler/failure/unknown-ref.json new file mode 100644 index 0000000000..7ae331d589 --- /dev/null +++ b/tests/goldens/compiler/failure/unknown-ref.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Model file models/marts/customer_totals.sql references unknown model 'stg_payments'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/unknown-scalar-function.json b/tests/goldens/compiler/failure/unknown-scalar-function.json new file mode 100644 index 0000000000..1a6bb7ca94 --- /dev/null +++ b/tests/goldens/compiler/failure/unknown-scalar-function.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Model file models/staging/stg_orders.sql references unknown SQL function 'is_large'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/unknown-source.json b/tests/goldens/compiler/failure/unknown-source.json new file mode 100644 index 0000000000..b62cf8f45d --- /dev/null +++ b/tests/goldens/compiler/failure/unknown-source.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Model file models/staging/stg_orders.sql references unknown source 'raw_payments'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/unknown-table-function.json b/tests/goldens/compiler/failure/unknown-table-function.json new file mode 100644 index 0000000000..73f39c7925 --- /dev/null +++ b/tests/goldens/compiler/failure/unknown-table-function.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Model file models/marts/customer_totals.sql references unknown table function 'table_fn__missing'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/unneeded-sql-analysis-opt-out.json b/tests/goldens/compiler/failure/unneeded-sql-analysis-opt-out.json new file mode 100644 index 0000000000..623f4193a5 --- /dev/null +++ b/tests/goldens/compiler/failure/unneeded-sql-analysis-opt-out.json @@ -0,0 +1,275 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P009", + "message": "`sql_analysis false` is not needed for model 'stg_orders'", + "resource_type": "model", + "resource_name": "stg_orders", + "path": "models/staging/stg_orders.sql", + "line": 3, + "column": 3, + "location": { + "path": "models/staging/stg_orders.sql", + "line": 3, + "column": 3 + }, + "help": "remove `sql_analysis false`; it is not hiding any findings\n = help: to allow `sql_analysis false` on any model, SQL test or audit, set this in sqlbuild_project.toml:\n [settings]\n require_sql_analysis = false", + "notes": [ + "sqlbuild_project.toml sets [settings] require_sql_analysis = true, which only allows `sql_analysis false` on SQL that SQLBuild cannot parse; this model parses successfully." + ] + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/unquoted-ref-name.json b/tests/goldens/compiler/failure/unquoted-ref-name.json new file mode 100644 index 0000000000..11c1f3b0c7 --- /dev/null +++ b/tests/goldens/compiler/failure/unquoted-ref-name.json @@ -0,0 +1,270 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P012", + "message": "__ref(stg_orders) is not a valid __ref() call", + "resource_type": "model", + "resource_name": "customer_totals", + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "location": { + "path": "models/marts/customer_totals.sql", + "line": 6, + "column": 6, + "end_line": 6, + "end_column": 23 + }, + "help": "__ref() takes exactly one double-quoted name, with no comments or extra spaces inside the parentheses: __ref(\"stg_orders\")" + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(stg_orders)", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/unset-environment-variable.json b/tests/goldens/compiler/failure/unset-environment-variable.json new file mode 100644 index 0000000000..330dd64b66 --- /dev/null +++ b/tests/goldens/compiler/failure/unset-environment-variable.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "unknown environment variable '@@ENV:SQB_DIFFERENTIAL_UNSET' in '/models/staging/stg_orders.sql'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/failure/unused-declaration.json b/tests/goldens/compiler/failure/unused-declaration.json new file mode 100644 index 0000000000..8daa69c5ed --- /dev/null +++ b/tests/goldens/compiler/failure/unused-declaration.json @@ -0,0 +1,269 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "S010", + "message": "Unused local declaration 'constant:spare' at models/staging/_sqlbuild/_constants/limits.sql; remove it or add a genuine runtime use", + "path": "models/staging/_sqlbuild/_constants/limits.sql", + "line": 1, + "column": 1, + "location": { + "path": "models/staging/_sqlbuild/_constants/limits.sql", + "line": 1, + "column": 1 + } + } + ] + } + ], + "compiled": { + "models/marts/customer_totals.sql": [ + "SELECT customer_id, SUM(amount) AS total_amount", + "FROM __ref(\"stg_orders\")", + "GROUP BY customer_id", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT order_id, customer_id, amount, status", + "FROM __source(\"raw_orders\")", + "" + ] + }, + "manifest": { + "nodes": { + "model.failure_corpus.customer_totals": { + "database": null, + "schema": "main", + "name": "customer_totals", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/marts/customer_totals.sql", + "original_file_path": "models/marts/customer_totals.sql", + "unique_id": "model.failure_corpus.customer_totals", + "fqn": [ + "failure_corpus", + "models", + "marts", + "customer_totals" + ], + "alias": "customer_totals", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Order totals per customer", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_totals", + "depends_on": { + "macros": [], + "nodes": [ + "model.failure_corpus.stg_orders" + ] + } + }, + "model.failure_corpus.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "failure_corpus", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.failure_corpus.stg_orders", + "fqn": [ + "failure_corpus", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Staged orders", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.failure_corpus.raw_orders" + ] + } + } + }, + "sources": { + "source.failure_corpus.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "failure_corpus", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.failure_corpus.raw_orders", + "fqn": [ + "failure_corpus", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Orders feed.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.failure_corpus.customer_totals": [ + "model.failure_corpus.stg_orders" + ], + "model.failure_corpus.stg_orders": [ + "source.failure_corpus.raw_orders" + ], + "source.failure_corpus.raw_orders": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/failure/variable-not-defined.json b/tests/goldens/compiler/failure/variable-not-defined.json new file mode 100644 index 0000000000..4054304f5e --- /dev/null +++ b/tests/goldens/compiler/failure/variable-not-defined.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "unknown project variable '@@region' in '/models/staging/stg_orders.sql'. Available vars: none" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/fixture/dbt_interop.json b/tests/goldens/compiler/fixture/dbt_interop.json new file mode 100644 index 0000000000..0bd687b95e --- /dev/null +++ b/tests/goldens/compiler/fixture/dbt_interop.json @@ -0,0 +1,66 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "C214", + "message": "Model file models/marts/downstream_orders.sql uses __dbt_ref(\"fact_orders\") but no dbt manifest was found", + "help": "Run dbt compile or configure dbt target_path so SQLBuild can read manifest.json." + } + ] + }, + { + "label": "compile-warm", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "C214", + "message": "Model file models/marts/downstream_orders.sql uses __dbt_ref(\"fact_orders\") but no dbt manifest was found", + "help": "Run dbt compile or configure dbt target_path so SQLBuild can read manifest.json." + } + ] + }, + { + "label": "compile-store-warm", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "C214", + "message": "Model file models/marts/downstream_orders.sql uses __dbt_ref(\"fact_orders\") but no dbt manifest was found", + "help": "Run dbt compile or configure dbt target_path so SQLBuild can read manifest.json." + } + ] + }, + { + "label": "plan", + "exit_code": 1, + "diagnostics": [ + "Project discovery START", + "Project assembly START", + "Declaration parsing START", + "Declaration parsing OK ()", + "Python discovery START", + "Python discovery OK ()", + "Project assembly OK ()", + "Project discovery OK ()", + "External manifest discovery START", + "External manifest discovery OK ()", + "Compiling project...", + "error[C214]: Model file models/marts/downstream_orders.sql uses __dbt_ref(\"fact_orders\") but no dbt manifest was found", + " = help: Run dbt compile or configure dbt target_path so SQLBuild can read manifest.json.", + "", + "" + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/fixture/source_loader_strategies.json b/tests/goldens/compiler/fixture/source_loader_strategies.json new file mode 100644 index 0000000000..122ad0c76d --- /dev/null +++ b/tests/goldens/compiler/fixture/source_loader_strategies.json @@ -0,0 +1,368 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-store-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": {}, + "manifest": { + "nodes": {}, + "sources": { + "source.source_loader_strategies.raw_countries": { + "database": null, + "schema": "", + "name": "raw_countries", + "resource_type": "source", + "package_name": "source_loader_strategies", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.source_loader_strategies.raw_countries", + "fqn": [ + "source_loader_strategies", + "raw_countries" + ], + "source_name": "raw_countries", + "source_description": "", + "loader": "", + "identifier": "raw_countries", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Test source raw_countries.", + "columns": { + "country_id": { + "name": "country_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "country_code": { + "name": "country_code", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "country_name": { + "name": "country_name", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "raw_countries", + "auto_load": false, + "write_strategy": "table" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.source_loader_strategies.raw_webhook_events": { + "database": null, + "schema": "", + "name": "raw_webhook_events", + "resource_type": "source", + "package_name": "source_loader_strategies", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.source_loader_strategies.raw_webhook_events", + "fqn": [ + "source_loader_strategies", + "raw_webhook_events" + ], + "source_name": "raw_webhook_events", + "source_description": "", + "loader": "", + "identifier": "raw_webhook_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Test source raw_webhook_events.", + "columns": { + "event_id": { + "name": "event_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "event_name": { + "name": "event_name", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "raw_webhook_events", + "auto_load": false, + "write_strategy": "append" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.source_loader_strategies.raw_order_events": { + "database": null, + "schema": "", + "name": "raw_order_events", + "resource_type": "source", + "package_name": "source_loader_strategies", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.source_loader_strategies.raw_order_events", + "fqn": [ + "source_loader_strategies", + "raw_order_events" + ], + "source_name": "raw_order_events", + "source_description": "", + "loader": "", + "identifier": "raw_order_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Test source raw_order_events.", + "columns": { + "event_id": { + "name": "event_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "event_at": { + "name": "event_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount_cents": { + "name": "amount_cents", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "raw_order_events", + "auto_load": false, + "write_strategy": "delete_insert", + "cursor_column": "event_at" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.source_loader_strategies.raw_customers": { + "database": null, + "schema": "", + "name": "raw_customers", + "resource_type": "source", + "package_name": "source_loader_strategies", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.source_loader_strategies.raw_customers", + "fqn": [ + "source_loader_strategies", + "raw_customers" + ], + "source_name": "raw_customers", + "source_description": "", + "loader": "", + "identifier": "raw_customers", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Test source raw_customers.", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "plan_name": { + "name": "plan_name", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "updated_at": { + "name": "updated_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "raw_customers", + "auto_load": false, + "write_strategy": "merge", + "cursor_column": "updated_at", + "unique_key": [ + "customer_id" + ] + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.source_loader_strategies.raw_loader_status": { + "database": null, + "schema": "", + "name": "raw_loader_status", + "resource_type": "source", + "package_name": "source_loader_strategies", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.source_loader_strategies.raw_loader_status", + "fqn": [ + "source_loader_strategies", + "raw_loader_status" + ], + "source_name": "raw_loader_status", + "source_description": "", + "loader": "", + "identifier": "raw_loader_status", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Test source raw_loader_status.", + "columns": { + "status_id": { + "name": "status_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "status_name": { + "name": "status_name", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "loaded_by": { + "name": "loaded_by", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "raw_loader_status", + "auto_load": false + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": {}, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "source.source_loader_strategies.raw_countries": [], + "source.source_loader_strategies.raw_webhook_events": [], + "source.source_loader_strategies.raw_order_events": [], + "source.source_loader_strategies.raw_customers": [], + "source.source_loader_strategies.raw_loader_status": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/fixture/waffle_shop.json b/tests/goldens/compiler/fixture/waffle_shop.json new file mode 100644 index 0000000000..01bd0de7a2 --- /dev/null +++ b/tests/goldens/compiler/fixture/waffle_shop.json @@ -0,0 +1,2110 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-store-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "audits/generic/customer_status_snapshot/not_null__customer_id.sql": [ + "SELECT customer_id", + "FROM __ref(\"customer_status_snapshot\")", + "WHERE customer_id IS NULL", + "" + ], + "audits/generic/customer_status_snapshot/unique__customer_id.sql": [ + "SELECT customer_id, COUNT(*) AS duplicate_count", + "FROM __ref(\"customer_status_snapshot\")", + "WHERE customer_id IS NOT NULL", + "GROUP BY customer_id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/daily_activity_rollup/daily_orders_placed_is_non_negative.sql": [ + "SELECT *", + "FROM __ref(\"daily_activity_rollup\")", + "WHERE NOT (orders_placed >= 0)", + "" + ], + "audits/generic/daily_activity_rollup/not_null__activity_day.sql": [ + "SELECT activity_day", + "FROM __ref(\"daily_activity_rollup\")", + "WHERE activity_day IS NULL", + "" + ], + "audits/generic/daily_order_partitioned/not_null__order_date.sql": [ + "SELECT order_date", + "FROM __ref(\"daily_order_partitioned\")", + "WHERE order_date IS NULL", + "" + ], + "audits/generic/daily_order_partitioned/waffles_ordered_is_positive.sql": [ + "SELECT *", + "FROM __ref(\"daily_order_partitioned\")", + "WHERE NOT (waffles_ordered > 0)", + "" + ], + "audits/generic/daily_revenue/revenue_is_non_negative.sql": [ + "SELECT *", + "FROM __ref(\"daily_revenue\")", + "WHERE NOT (total_revenue_cents >= 0)", + "" + ], + "audits/generic/dim_customers/not_null__customer_id.sql": [ + "SELECT customer_id", + "FROM __ref(\"dim_customers\")", + "WHERE customer_id IS NULL", + "" + ], + "audits/generic/dim_customers/unique__customer_id.sql": [ + "SELECT customer_id, COUNT(*) AS duplicate_count", + "FROM __ref(\"dim_customers\")", + "WHERE customer_id IS NOT NULL", + "GROUP BY customer_id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/fact_orders/not_null__order_id.sql": [ + "SELECT order_id", + "FROM __ref(\"fact_orders\")", + "WHERE order_id IS NULL", + "" + ], + "audits/generic/hourly_activity_with_daily_context/day_orders_cover_hourly_orders.sql": [ + "SELECT *", + "FROM __ref(\"hourly_activity_with_daily_context\")", + "WHERE NOT (day_orders_placed >= orders_placed)", + "" + ], + "audits/generic/hourly_activity_with_daily_context/not_null__activity_hour.sql": [ + "SELECT activity_hour", + "FROM __ref(\"hourly_activity_with_daily_context\")", + "WHERE activity_hour IS NULL", + "" + ], + "audits/generic/hourly_order_activity/not_null__activity_hour.sql": [ + "SELECT activity_hour", + "FROM __ref(\"hourly_order_activity\")", + "WHERE activity_hour IS NULL", + "" + ], + "audits/generic/hourly_order_activity/orders_placed_is_non_negative.sql": [ + "SELECT *", + "FROM __ref(\"hourly_order_activity\")", + "WHERE NOT (orders_placed >= 0)", + "" + ], + "audits/generic/order_status_index/not_null__order_id.sql": [ + "SELECT order_id", + "FROM __ref(\"order_status_index\")", + "WHERE order_id IS NULL", + "" + ], + "audits/generic/order_status_index/unique__order_id.sql": [ + "SELECT order_id, COUNT(*) AS duplicate_count", + "FROM __ref(\"order_status_index\")", + "WHERE order_id IS NOT NULL", + "GROUP BY order_id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/stg_customers/not_null__customer_id.sql": [ + "SELECT customer_id", + "FROM __ref(\"stg_customers\")", + "WHERE customer_id IS NULL", + "" + ], + "audits/generic/stg_customers/not_null__email.sql": [ + "SELECT email", + "FROM __ref(\"stg_customers\")", + "WHERE email IS NULL", + "" + ], + "audits/generic/stg_customers/unique__customer_id.sql": [ + "SELECT customer_id, COUNT(*) AS duplicate_count", + "FROM __ref(\"stg_customers\")", + "WHERE customer_id IS NOT NULL", + "GROUP BY customer_id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/stg_orders/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"stg_orders\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'preparing', 'ready', 'completed', 'cancelled')", + "" + ], + "audits/generic/stg_orders/not_null__customer_id.sql": [ + "SELECT customer_id", + "FROM __ref(\"stg_orders\")", + "WHERE customer_id IS NULL", + "" + ], + "audits/generic/stg_orders/not_null__order_id.sql": [ + "SELECT order_id", + "FROM __ref(\"stg_orders\")", + "WHERE order_id IS NULL", + "" + ], + "audits/generic/stg_orders/relationships__waffle_type_id.sql": [ + "SELECT waffle_type_id", + "FROM __ref(\"stg_orders\")", + "WHERE waffle_type_id IS NOT NULL", + " AND waffle_type_id NOT IN (", + " SELECT waffle_type_id", + " FROM __seed(\"waffle_types\")", + " WHERE waffle_type_id IS NOT NULL", + " )", + "" + ], + "audits/generic/stg_orders/unique__order_id.sql": [ + "SELECT order_id, COUNT(*) AS duplicate_count", + "FROM __ref(\"stg_orders\")", + "WHERE order_id IS NOT NULL", + "GROUP BY order_id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/stg_payments/not_null__order_id.sql": [ + "SELECT order_id", + "FROM __ref(\"stg_payments\")", + "WHERE order_id IS NULL", + "" + ], + "audits/generic/stg_payments/not_null__payment_id.sql": [ + "SELECT payment_id", + "FROM __ref(\"stg_payments\")", + "WHERE payment_id IS NULL", + "" + ], + "audits/generic/stg_payments/relationships__order_id.sql": [ + "SELECT order_id", + "FROM __ref(\"stg_payments\")", + "WHERE order_id IS NOT NULL", + " AND order_id NOT IN (", + " SELECT id", + " FROM __source(\"raw_orders\")", + " WHERE id IS NOT NULL", + " )", + "" + ], + "audits/generic/stg_payments/unique__payment_id.sql": [ + "SELECT payment_id, COUNT(*) AS duplicate_count", + "FROM __ref(\"stg_payments\")", + "WHERE payment_id IS NOT NULL", + "GROUP BY payment_id", + "HAVING COUNT(*) > 1", + "" + ], + "functions/python/is_completed_order_py.sql": [ + "REGISTER PYTHON FUNCTION is_completed_order_py(STRING) RETURNS BOOLEAN", + "" + ], + "functions/sql/customer_orders.sql": [ + "CREATE OR REPLACE MACRO main.customer_orders(p_customer_id) AS TABLE", + "SELECT", + " order_id,", + " ordered_at,", + " waffle_name,", + " line_total_cents,", + " order_status,", + " is_completed_order", + "FROM __ref(\"fact_orders\")", + "WHERE customer_id = p_customer_id", + "" + ], + "functions/sql/is_completed_order.sql": [ + "CREATE OR REPLACE MACRO main.is_completed_order(order_status) AS (", + "order_status = 'completed'", + ")", + "" + ], + "models/intermediate/customer_status_snapshot.sql": [ + "SELECT", + " customer_id,", + " MAX(ordered_at) AS last_ordered_at,", + " MAX(order_status) AS latest_order_status,", + " COUNT(*) AS total_orders,", + " SUM(line_total_cents) AS total_revenue_cents", + "FROM __ref(\"fact_orders\")", + "GROUP BY customer_id", + "" + ], + "models/intermediate/order_status_index.sql": [ + "SELECT", + " order_id,", + " customer_id,", + " order_status,", + " ordered_at,", + " line_total_cents", + "FROM __ref(\"fact_orders\")", + "" + ], + "models/marts/daily_activity_rollup.sql": [ + "SELECT", + " DATE_TRUNC('day', activity_hour) AS activity_day,", + " SUM(orders_placed) AS orders_placed,", + " SUM(waffles_ordered) AS waffles_ordered,", + " SUM(revenue_cents) AS revenue_cents", + "FROM __ref(\"hourly_order_activity\")", + "GROUP BY DATE_TRUNC('day', activity_hour)", + "" + ], + "models/marts/daily_order_partitioned.sql": [ + "SELECT", + " CAST(o.ordered_at AS DATE) AS order_date,", + " COUNT(DISTINCT o.order_id) AS order_count,", + " SUM(o.quantity) AS waffles_ordered,", + " COUNT(DISTINCT o.customer_id) AS unique_customers", + "FROM __ref(\"stg_orders\") o", + "WHERE CAST(o.ordered_at AS DATE) >= CAST(@@@partition_start AS DATE)", + " AND CAST(o.ordered_at AS DATE) < CAST(@@@partition_end AS DATE)", + "GROUP BY CAST(o.ordered_at AS DATE)", + "" + ], + "models/marts/daily_revenue.sql": [ + "SELECT", + " CAST(o.ordered_at AS DATE) AS revenue_date,", + " COUNT(DISTINCT o.order_id) AS order_count,", + " SUM(o.quantity) AS waffles_sold,", + " SUM(p.amount_cents) AS total_revenue_cents,", + " SUM(p.amount_cents) / COUNT(DISTINCT o.order_id) AS avg_order_value_cents", + "FROM __ref(\"stg_orders\") o", + "INNER JOIN __ref(\"stg_payments\") p ON o.order_id = p.order_id AND p.payment_status = 'success'", + "GROUP BY CAST(o.ordered_at AS DATE)", + "" + ], + "models/marts/dim_customers.sql": [ + "SELECT", + " c.customer_id,", + " c.first_name,", + " c.last_name,", + " c.email,", + " c.created_at AS customer_since,", + " COUNT(DISTINCT o.order_id) AS lifetime_orders,", + " COALESCE(SUM(p.amount_cents), 0) AS lifetime_spend_cents", + "FROM __ref(\"stg_customers\") c", + "LEFT JOIN __ref(\"stg_orders\") o ON c.customer_id = o.customer_id", + "LEFT JOIN __ref(\"stg_payments\") p ON o.order_id = p.order_id AND p.payment_status = 'success'", + "GROUP BY c.customer_id, c.first_name, c.last_name, c.email, c.created_at", + "" + ], + "models/marts/fact_orders.sql": [ + "SELECT", + " o.order_id,", + " o.customer_id,", + " o.waffle_type_id,", + " w.waffle_name,", + " w.category AS waffle_category,", + " o.quantity,", + " w.price_cents * o.quantity AS line_total_cents,", + " o.ordered_at,", + " o.status AS order_status,", + " __udf(\"is_completed_order\")(o.status) AS is_completed_order,", + " __udf(\"is_completed_order_py\")(o.status) AS is_completed_order_py,", + " p.payment_method,", + " p.payment_status,", + " p.amount_cents AS payment_amount_cents", + "FROM __ref(\"stg_orders\") o", + "LEFT JOIN __seed(\"waffle_types\") w ON o.waffle_type_id = w.waffle_type_id", + "LEFT JOIN __ref(\"stg_payments\") p ON o.order_id = p.order_id", + "" + ], + "models/marts/hourly_activity_with_daily_context.sql": [ + "SELECT", + " h.activity_hour,", + " h.orders_placed,", + " d.orders_placed AS day_orders_placed,", + " h.waffles_ordered,", + " h.revenue_cents", + "FROM __ref(\"hourly_order_activity\") h", + "INNER JOIN __ref(\"daily_activity_rollup\") d", + " ON DATE_TRUNC('day', h.activity_hour) = d.activity_day", + "" + ], + "models/marts/hourly_order_activity.sql": [ + "SELECT", + " DATE_TRUNC('hour', o.ordered_at) AS activity_hour,", + " COUNT(*) AS orders_placed,", + " SUM(o.quantity) AS waffles_ordered,", + " SUM(o.line_total_cents) AS revenue_cents", + "FROM __ref(\"fact_orders\") o", + "GROUP BY DATE_TRUNC('hour', o.ordered_at)", + "" + ], + "models/marts/scenario_order_prices.sql": [ + "SELECT", + " o.order_id,", + " o.quantity,", + " w.waffle_name,", + " w.price_cents,", + " w.price_cents * o.quantity AS line_total_cents,", + " p.amount_cents AS payment_amount_cents", + "FROM __ref(\"stg_orders\") o", + "INNER JOIN __seed(\"waffle_types\") w ON o.waffle_type_id = w.waffle_type_id", + "LEFT JOIN __ref(\"stg_payments\") p ON o.order_id = p.order_id", + "" + ], + "models/staging/stg_customers.sql": [ + "SELECT", + " id AS customer_id,", + " first_name,", + " last_name,", + " email,", + " created_at", + "FROM __source(\"raw_customers\")", + "" + ], + "models/staging/stg_orders.sql": [ + "SELECT", + " id AS order_id,", + " customer_id,", + " waffle_type_id,", + " quantity,", + " ordered_at,", + " status", + "FROM __source(\"raw_orders\")", + "" + ], + "models/staging/stg_payments.sql": [ + "SELECT", + " id AS payment_id,", + " order_id,", + " amount_cents,", + " payment_method,", + " paid_at,", + " status AS payment_status", + "FROM __source(\"raw_payments\")", + "" + ], + "tests/fact_orders/test_fact_orders.sql": [ + "WITH __ref__stg_orders AS (SELECT", + " 1 AS order_id,", + " 100 AS customer_id,", + " 2 AS waffle_type_id,", + " 3 AS quantity,", + " CAST('2026-04-01 10:00:00' AS TIMESTAMP) AS ordered_at,", + " 'completed' AS status),", + "__ref__stg_payments AS (SELECT", + " 10 AS payment_id,", + " 1 AS order_id,", + " 2850 AS amount_cents,", + " 'card' AS payment_method,", + " CAST('2026-04-01 10:05:00' AS TIMESTAMP) AS paid_at,", + " 'success' AS payment_status),", + "__seed__waffle_types AS (SELECT", + " 2 AS waffle_type_id,", + " 'Liege' AS waffle_name,", + " 'sweet' AS category,", + " 950 AS price_cents),", + "__ref__fact_orders AS (SELECT", + " o.order_id,", + " o.customer_id,", + " o.waffle_type_id,", + " w.waffle_name,", + " w.category AS waffle_category,", + " o.quantity,", + " w.price_cents * o.quantity AS line_total_cents,", + " o.ordered_at,", + " o.status AS order_status,", + " main.is_completed_order(o.status) AS is_completed_order,", + " is_completed_order_py(o.status) AS is_completed_order_py,", + " p.payment_method,", + " p.payment_status,", + " p.amount_cents AS payment_amount_cents", + "FROM __ref__stg_orders o", + "LEFT JOIN __seed__waffle_types w ON o.waffle_type_id = w.waffle_type_id", + "LEFT JOIN __ref__stg_payments p ON o.order_id = p.order_id),", + "__actual__fact_orders AS (SELECT * FROM __ref__fact_orders),", + "__expected__fact_orders AS (SELECT", + " 1 AS order_id,", + " 100 AS customer_id,", + " 2 AS waffle_type_id,", + " 'Liege' AS waffle_name,", + " 'sweet' AS waffle_category,", + " 3 AS quantity,", + " 2850 AS line_total_cents,", + " CAST('2026-04-01 10:00:00' AS TIMESTAMP) AS ordered_at,", + " 'completed' AS order_status,", + " TRUE AS is_completed_order,", + " TRUE AS is_completed_order_py,", + " 'card' AS payment_method,", + " 'success' AS payment_status,", + " 2850 AS payment_amount_cents),", + "__assert__line_totals_are_non_negative AS (SELECT *", + " FROM __ref__fact_orders", + " WHERE line_total_cents < 0)", + "SELECT 0 AS step_index, 'fact_orders' AS model_name, (SELECT COUNT(*) FROM __actual__fact_orders) AS actual_count, (SELECT COUNT(*) FROM __expected__fact_orders) AS expected_count, (SELECT COUNT(*) FROM (SELECT order_id, customer_id, waffle_type_id, waffle_name, waffle_category, quantity, line_total_cents, ordered_at, order_status, is_completed_order, is_completed_order_py, payment_method, payment_status, payment_amount_cents FROM __actual__fact_orders EXCEPT SELECT order_id, customer_id, waffle_type_id, waffle_name, waffle_category, quantity, line_total_cents, ordered_at, order_status, is_completed_order, is_completed_order_py, payment_method, payment_status, payment_amount_cents FROM __expected__fact_orders) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT order_id, customer_id, waffle_type_id, waffle_name, waffle_category, quantity, line_total_cents, ordered_at, order_status, is_completed_order, is_completed_order_py, payment_method, payment_status, payment_amount_cents FROM __expected__fact_orders EXCEPT SELECT order_id, customer_id, waffle_type_id, waffle_name, waffle_category, quantity, line_total_cents, ordered_at, order_status, is_completed_order, is_completed_order_py, payment_method, payment_status, payment_amount_cents FROM __actual__fact_orders) AS __sqlbuild_missing) AS missing_count", + "UNION ALL", + "SELECT 1 AS step_index, 'assertion line_totals_are_non_negative' AS model_name, (SELECT COUNT(*) FROM __assert__line_totals_are_non_negative) AS actual_count, 0 AS expected_count, (SELECT COUNT(*) FROM __assert__line_totals_are_non_negative) AS unexpected_count, 0 AS missing_count", + "" + ], + "tests/macro calculates_line_total_cents/calculates_line_total_cents.sql": [ + "WITH input_values AS (SELECT 950 AS price_cents, 3 AS quantity),", + "__actual__macro_calculates_line_total_cents AS (SELECT price_cents * quantity AS line_total_cents", + " FROM input_values),", + "__expected__macro_calculates_line_total_cents AS (SELECT 2850 AS line_total_cents)", + "SELECT 0 AS step_index, 'macro calculates_line_total_cents' AS model_name, (SELECT COUNT(*) FROM __actual__macro_calculates_line_total_cents) AS actual_count, (SELECT COUNT(*) FROM __expected__macro_calculates_line_total_cents) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__macro_calculates_line_total_cents EXCEPT SELECT * FROM __expected__macro_calculates_line_total_cents) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__macro_calculates_line_total_cents EXCEPT SELECT * FROM __actual__macro_calculates_line_total_cents) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/stg_orders/test_stg_orders.sql": [ + "WITH __source__raw_orders AS (SELECT", + " 1 AS id,", + " 100 AS customer_id,", + " 2 AS waffle_type_id,", + " 3 AS quantity,", + " '2026-04-01 10:00:00' AS ordered_at,", + " 'completed' AS status),", + "__ref__stg_orders AS (SELECT", + " id AS order_id,", + " customer_id,", + " waffle_type_id,", + " quantity,", + " ordered_at,", + " status", + "FROM __source__raw_orders),", + "__actual__stg_orders AS (SELECT * FROM __ref__stg_orders),", + "__expected__stg_orders AS (SELECT", + " 1 AS order_id,", + " 100 AS customer_id,", + " 2 AS waffle_type_id,", + " 3 AS quantity,", + " '2026-04-01 10:00:00' AS ordered_at,", + " 'completed' AS status),", + "__assert__order_ids_are_not_null AS (SELECT *", + " FROM __ref__stg_orders", + " WHERE order_id IS NULL)", + "SELECT 0 AS step_index, 'stg_orders' AS model_name, (SELECT COUNT(*) FROM __actual__stg_orders) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_orders) AS expected_count, (SELECT COUNT(*) FROM (SELECT order_id, customer_id, waffle_type_id, quantity, ordered_at, status FROM __actual__stg_orders EXCEPT SELECT order_id, customer_id, waffle_type_id, quantity, ordered_at, status FROM __expected__stg_orders) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT order_id, customer_id, waffle_type_id, quantity, ordered_at, status FROM __expected__stg_orders EXCEPT SELECT order_id, customer_id, waffle_type_id, quantity, ordered_at, status FROM __actual__stg_orders) AS __sqlbuild_missing) AS missing_count", + "UNION ALL", + "SELECT 1 AS step_index, 'assertion order_ids_are_not_null' AS model_name, (SELECT COUNT(*) FROM __assert__order_ids_are_not_null) AS actual_count, 0 AS expected_count, (SELECT COUNT(*) FROM __assert__order_ids_are_not_null) AS unexpected_count, 0 AS missing_count", + "" + ], + "tests/table_fn returns_customer_orders/returns_customer_orders.sql": [ + "WITH __actual__table_fn_returns_customer_orders AS (SELECT", + " order_id,", + " order_status,", + " is_completed_order", + " FROM main.customer_orders(1)),", + "__expected__table_fn_returns_customer_orders AS (SELECT 1 AS order_id, 'completed' AS order_status, TRUE AS is_completed_order", + " UNION ALL", + " SELECT 2 AS order_id, 'completed' AS order_status, TRUE AS is_completed_order", + " UNION ALL", + " SELECT 8 AS order_id, 'completed' AS order_status, TRUE AS is_completed_order)", + "SELECT 0 AS step_index, 'table_fn returns_customer_orders' AS model_name, (SELECT COUNT(*) FROM __actual__table_fn_returns_customer_orders) AS actual_count, (SELECT COUNT(*) FROM __expected__table_fn_returns_customer_orders) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__table_fn_returns_customer_orders EXCEPT SELECT * FROM __expected__table_fn_returns_customer_orders) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__table_fn_returns_customer_orders EXCEPT SELECT * FROM __actual__table_fn_returns_customer_orders) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/udf detects_completed_orders/detects_completed_orders.sql": [ + "WITH input_values AS (SELECT 'completed' AS order_status", + " UNION ALL", + " SELECT 'pending' AS order_status),", + "__actual__udf_detects_completed_orders AS (SELECT", + " order_status,", + " main.is_completed_order(order_status) AS is_completed_order", + " FROM input_values),", + "__expected__udf_detects_completed_orders AS (SELECT 'completed' AS order_status, TRUE AS is_completed_order", + " UNION ALL", + " SELECT 'pending' AS order_status, FALSE AS is_completed_order)", + "SELECT 0 AS step_index, 'udf detects_completed_orders' AS model_name, (SELECT COUNT(*) FROM __actual__udf_detects_completed_orders) AS actual_count, (SELECT COUNT(*) FROM __expected__udf_detects_completed_orders) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__udf_detects_completed_orders EXCEPT SELECT * FROM __expected__udf_detects_completed_orders) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__udf_detects_completed_orders EXCEPT SELECT * FROM __actual__udf_detects_completed_orders) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.waffle_shop.customer_status_snapshot": { + "database": null, + "schema": "main", + "name": "customer_status_snapshot", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/intermediate/customer_status_snapshot.sql", + "original_file_path": "models/intermediate/customer_status_snapshot.sql", + "unique_id": "model.waffle_shop.customer_status_snapshot", + "fqn": [ + "waffle_shop", + "models", + "intermediate", + "customer_status_snapshot" + ], + "alias": "customer_status_snapshot", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "intermediate", + "acceptance" + ], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "merge", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "customer_id" + ], + "on_schema_change": "sync_all_columns", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "intermediate", + "acceptance" + ], + "description": "Merge-based customer snapshot with timestamp cursor and explicit backfill policies.", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.customer_status_snapshot", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.fact_orders" + ] + } + }, + "model.waffle_shop.order_status_index": { + "database": null, + "schema": "main", + "name": "order_status_index", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/intermediate/order_status_index.sql", + "original_file_path": "models/intermediate/order_status_index.sql", + "unique_id": "model.waffle_shop.order_status_index", + "fqn": [ + "waffle_shop", + "models", + "intermediate", + "order_status_index" + ], + "alias": "order_status_index", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "intermediate", + "acceptance" + ], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "append_new_columns", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "intermediate", + "acceptance" + ], + "description": "Integer-cursor incremental projection over fact orders.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.order_status_index", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.fact_orders" + ] + } + }, + "model.waffle_shop.daily_activity_rollup": { + "database": null, + "schema": "main", + "name": "daily_activity_rollup", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/daily_activity_rollup.sql", + "original_file_path": "models/marts/daily_activity_rollup.sql", + "unique_id": "model.waffle_shop.daily_activity_rollup", + "fqn": [ + "waffle_shop", + "models", + "marts", + "daily_activity_rollup" + ], + "alias": "daily_activity_rollup", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "marts", + "acceptance" + ], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts", + "acceptance" + ], + "description": "Downstream daily microbatch rollup with a wider batch size than its hourly upstream.", + "columns": { + "activity_day": { + "name": "activity_day", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.daily_activity_rollup", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.hourly_order_activity" + ] + } + }, + "model.waffle_shop.daily_order_partitioned": { + "database": null, + "schema": "main", + "name": "daily_order_partitioned", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/daily_order_partitioned.sql", + "original_file_path": "models/marts/daily_order_partitioned.sql", + "unique_id": "model.waffle_shop.daily_order_partitioned", + "fqn": [ + "waffle_shop", + "models", + "marts", + "daily_order_partitioned" + ], + "alias": "daily_order_partitioned", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "marts" + ], + "meta": {}, + "group": null, + "materialized": "partition_tracked", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts" + ], + "description": "Partition-tracked daily order summary using custom materialization.", + "columns": { + "order_date": { + "name": "order_date", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.daily_order_partitioned", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.stg_orders" + ] + } + }, + "model.waffle_shop.daily_revenue": { + "database": null, + "schema": "main", + "name": "daily_revenue", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/daily_revenue.sql", + "original_file_path": "models/marts/daily_revenue.sql", + "unique_id": "model.waffle_shop.daily_revenue", + "fqn": [ + "waffle_shop", + "models", + "marts", + "daily_revenue" + ], + "alias": "daily_revenue", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts" + ], + "description": "Daily revenue aggregation.", + "columns": { + "revenue_date": { + "name": "revenue_date", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.daily_revenue", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.stg_orders", + "model.waffle_shop.stg_payments" + ] + } + }, + "model.waffle_shop.dim_customers": { + "database": null, + "schema": "main", + "name": "dim_customers", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/dim_customers.sql", + "original_file_path": "models/marts/dim_customers.sql", + "unique_id": "model.waffle_shop.dim_customers", + "fqn": [ + "waffle_shop", + "models", + "marts", + "dim_customers" + ], + "alias": "dim_customers", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts" + ], + "description": "Customer dimension with lifetime metrics.", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.dim_customers", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.stg_customers", + "model.waffle_shop.stg_orders", + "model.waffle_shop.stg_payments" + ] + } + }, + "model.waffle_shop.fact_orders": { + "database": null, + "schema": "main", + "name": "fact_orders", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/fact_orders.sql", + "original_file_path": "models/marts/fact_orders.sql", + "unique_id": "model.waffle_shop.fact_orders", + "fqn": [ + "waffle_shop", + "models", + "marts", + "fact_orders" + ], + "alias": "fact_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts" + ], + "description": "Order fact table with waffle and payment details.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.fact_orders", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.is_completed_order", + "model.waffle_shop.is_completed_order_py", + "model.waffle_shop.stg_orders", + "seed.waffle_shop.waffle_types", + "model.waffle_shop.stg_payments" + ] + } + }, + "model.waffle_shop.hourly_activity_with_daily_context": { + "database": null, + "schema": "main", + "name": "hourly_activity_with_daily_context", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/hourly_activity_with_daily_context.sql", + "original_file_path": "models/marts/hourly_activity_with_daily_context.sql", + "unique_id": "model.waffle_shop.hourly_activity_with_daily_context", + "fqn": [ + "waffle_shop", + "models", + "marts", + "hourly_activity_with_daily_context" + ], + "alias": "hourly_activity_with_daily_context", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "marts", + "acceptance" + ], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts", + "acceptance" + ], + "description": "Hourly downstream microbatch model that depends on a coarser-grain daily upstream.", + "columns": { + "activity_hour": { + "name": "activity_hour", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.hourly_activity_with_daily_context", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.hourly_order_activity", + "model.waffle_shop.daily_activity_rollup" + ] + } + }, + "model.waffle_shop.hourly_order_activity": { + "database": null, + "schema": "main", + "name": "hourly_order_activity", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/hourly_order_activity.sql", + "original_file_path": "models/marts/hourly_order_activity.sql", + "unique_id": "model.waffle_shop.hourly_order_activity", + "fqn": [ + "waffle_shop", + "models", + "marts", + "hourly_order_activity" + ], + "alias": "hourly_order_activity", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "marts" + ], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts" + ], + "description": "Hourly order activity aggregated via microbatch incremental.", + "columns": { + "activity_hour": { + "name": "activity_hour", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.hourly_order_activity", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.fact_orders" + ] + } + }, + "model.waffle_shop.scenario_order_prices": { + "database": null, + "schema": "main", + "name": "scenario_order_prices", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/marts/scenario_order_prices.sql", + "original_file_path": "models/marts/scenario_order_prices.sql", + "unique_id": "model.waffle_shop.scenario_order_prices", + "fqn": [ + "waffle_shop", + "models", + "marts", + "scenario_order_prices" + ], + "alias": "scenario_order_prices", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "marts", + "scenario" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "marts", + "scenario" + ], + "description": "Small model used by scenario CLI e2e retain coverage.", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.scenario_order_prices", + "depends_on": { + "macros": [], + "nodes": [ + "model.waffle_shop.stg_orders", + "seed.waffle_shop.waffle_types", + "model.waffle_shop.stg_payments" + ] + } + }, + "model.waffle_shop.stg_customers": { + "database": null, + "schema": "main", + "name": "stg_customers", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/staging/stg_customers.sql", + "original_file_path": "models/staging/stg_customers.sql", + "unique_id": "model.waffle_shop.stg_customers", + "fqn": [ + "waffle_shop", + "models", + "staging", + "stg_customers" + ], + "alias": "stg_customers", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Cleaned customer records.", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "email": { + "name": "email", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_customers", + "depends_on": { + "macros": [], + "nodes": [ + "source.waffle_shop.raw_customers" + ] + } + }, + "model.waffle_shop.stg_orders": { + "database": null, + "schema": "main", + "name": "stg_orders", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "unique_id": "model.waffle_shop.stg_orders", + "fqn": [ + "waffle_shop", + "models", + "staging", + "stg_orders" + ], + "alias": "stg_orders", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Cleaned order records.", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "waffle_type_id": { + "name": "waffle_type_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_orders", + "depends_on": { + "macros": [], + "nodes": [ + "source.waffle_shop.raw_orders" + ] + } + }, + "model.waffle_shop.stg_payments": { + "database": null, + "schema": "main", + "name": "stg_payments", + "resource_type": "model", + "package_name": "waffle_shop", + "path": "models/staging/stg_payments.sql", + "original_file_path": "models/staging/stg_payments.sql", + "unique_id": "model.waffle_shop.stg_payments", + "fqn": [ + "waffle_shop", + "models", + "staging", + "stg_payments" + ], + "alias": "stg_payments", + "config": { + "enabled": true, + "alias": null, + "schema": null, + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Cleaned payment records.", + "columns": { + "payment_id": { + "name": "payment_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_payments", + "depends_on": { + "macros": [], + "nodes": [ + "source.waffle_shop.raw_payments" + ] + } + }, + "seed.waffle_shop.waffle_types": { + "database": null, + "schema": "main", + "name": "waffle_types", + "resource_type": "seed", + "package_name": "waffle_shop", + "path": "seeds/waffle_types.csv", + "original_file_path": "seeds/waffle_types.csv", + "unique_id": "seed.waffle_shop.waffle_types", + "fqn": [ + "waffle_shop", + "seeds", + "waffle_types" + ], + "alias": "waffle_types", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "seed", + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + }, + "delimiter": ",", + "quote_columns": null + }, + "tags": [], + "description": "Waffle menu items with pricing.", + "columns": { + "waffle_type_id": { + "name": "waffle_type_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "waffle_name": { + "name": "waffle_name", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "category": { + "name": "category", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "price_cents": { + "name": "price_cents", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.waffle_types", + "root_path": null, + "depends_on": { + "macros": [] + } + } + }, + "sources": { + "source.waffle_shop.raw_customers": { + "database": null, + "schema": "", + "name": "raw_customers", + "resource_type": "source", + "package_name": "waffle_shop", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.waffle_shop.raw_customers", + "fqn": [ + "waffle_shop", + "raw_customers" + ], + "source_name": "raw_customers", + "source_description": "", + "loader": "", + "identifier": "raw_customers", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Test source raw_customers.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "first_name": { + "name": "first_name", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "last_name": { + "name": "last_name", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "email": { + "name": "email", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "raw_customers", + "auto_load": false, + "write_strategy": "table" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.waffle_shop.raw_orders": { + "database": null, + "schema": "", + "name": "raw_orders", + "resource_type": "source", + "package_name": "waffle_shop", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.waffle_shop.raw_orders", + "fqn": [ + "waffle_shop", + "raw_orders" + ], + "source_name": "raw_orders", + "source_description": "", + "loader": "", + "identifier": "raw_orders", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Test source raw_orders.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "waffle_type_id": { + "name": "waffle_type_id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "quantity": { + "name": "quantity", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "ordered_at": { + "name": "ordered_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "raw_orders", + "auto_load": false, + "write_strategy": "delete_insert", + "cursor_column": "ordered_at" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.waffle_shop.raw_payments": { + "database": null, + "schema": "", + "name": "raw_payments", + "resource_type": "source", + "package_name": "waffle_shop", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.waffle_shop.raw_payments", + "fqn": [ + "waffle_shop", + "raw_payments" + ], + "source_name": "raw_payments", + "source_description": "", + "loader": "", + "identifier": "raw_payments", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Test source raw_payments.", + "columns": { + "amount_cents": { + "name": "amount_cents", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.waffle_shop.line_total_cents": { + "name": "line_total_cents", + "resource_type": "macro", + "package_name": "waffle_shop", + "path": "macros/currency.py", + "original_file_path": "macros/currency.py", + "unique_id": "macro.waffle_shop.line_total_cents", + "macro_sql": "\"\"\"Currency formatting macros.\"\"\"\n\n\ndef line_total_cents(price_cents: str, quantity: str) -> str:\n \"\"\"Calculate line total cents from a unit price and quantity.\"\"\"\n return f\"{price_cents} * {quantity}\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.waffle_shop.timestamp_trunc": { + "name": "timestamp_trunc", + "resource_type": "macro", + "package_name": "waffle_shop", + "path": "models/marts/_macros/time.py", + "original_file_path": "models/marts/_macros/time.py", + "unique_id": "macro.waffle_shop.timestamp_trunc", + "macro_sql": "\"\"\"Time expression macros.\"\"\"\n\nfrom sqlbuild.compiler.compile.models import MacroContext\n\n\ndef timestamp_trunc(ctx: MacroContext, grain: str, expression: str) -> str:\n \"\"\"Render timestamp truncation for the active adapter.\"\"\"\n\n if ctx.adapter_name == \"bigquery\":\n return f\"TIMESTAMP_TRUNC({expression}, {grain.upper()})\"\n return f\"DATE_TRUNC('{grain}', {expression})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/marts" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.waffle_shop.customer_status_snapshot": [ + "model.waffle_shop.fact_orders" + ], + "model.waffle_shop.order_status_index": [ + "model.waffle_shop.fact_orders" + ], + "model.waffle_shop.daily_activity_rollup": [ + "model.waffle_shop.hourly_order_activity" + ], + "model.waffle_shop.daily_order_partitioned": [ + "model.waffle_shop.stg_orders" + ], + "model.waffle_shop.daily_revenue": [ + "model.waffle_shop.stg_orders", + "model.waffle_shop.stg_payments" + ], + "model.waffle_shop.dim_customers": [ + "model.waffle_shop.stg_customers", + "model.waffle_shop.stg_orders", + "model.waffle_shop.stg_payments" + ], + "model.waffle_shop.fact_orders": [ + "model.waffle_shop.is_completed_order", + "model.waffle_shop.is_completed_order_py", + "model.waffle_shop.stg_orders", + "seed.waffle_shop.waffle_types", + "model.waffle_shop.stg_payments" + ], + "model.waffle_shop.hourly_activity_with_daily_context": [ + "model.waffle_shop.hourly_order_activity", + "model.waffle_shop.daily_activity_rollup" + ], + "model.waffle_shop.hourly_order_activity": [ + "model.waffle_shop.fact_orders" + ], + "model.waffle_shop.scenario_order_prices": [ + "model.waffle_shop.stg_orders", + "seed.waffle_shop.waffle_types", + "model.waffle_shop.stg_payments" + ], + "model.waffle_shop.stg_customers": [ + "source.waffle_shop.raw_customers" + ], + "model.waffle_shop.stg_orders": [ + "source.waffle_shop.raw_orders" + ], + "model.waffle_shop.stg_payments": [ + "source.waffle_shop.raw_payments" + ], + "source.waffle_shop.raw_customers": [], + "source.waffle_shop.raw_orders": [], + "source.waffle_shop.raw_payments": [], + "seed.waffle_shop.waffle_types": [], + "model.waffle_shop.customer_orders": [ + "model.waffle_shop.fact_orders" + ], + "model.waffle_shop.is_completed_order": [], + "model.waffle_shop.is_completed_order_py": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/seed/0-postgres.json b/tests/goldens/compiler/seed/0-postgres.json new file mode 100644 index 0000000000..13f05d651d --- /dev/null +++ b/tests/goldens/compiler/seed/0-postgres.json @@ -0,0 +1,2906 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "audits/generic/checked_stg_fulfillment_1/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"checked_stg_fulfillment_1\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'expédié', '取消', 'returned ✓')", + "" + ], + "audits/generic/checked_stg_fulfillment_1/expression_is_true.sql": [ + "SELECT *", + "FROM __ref(\"checked_stg_fulfillment_1\")", + "WHERE NOT (amount >= -1000)", + "" + ], + "audits/generic/checked_stg_fulfillment_1/relationships__id.sql": [ + "SELECT id", + "FROM __ref(\"checked_stg_fulfillment_1\")", + "WHERE id IS NOT NULL", + " AND id NOT IN (", + " SELECT id", + " FROM __ref(\"stg_fulfillment_1\")", + " WHERE id IS NOT NULL", + " )", + "" + ], + "audits/generic/fulfillment_summary_1/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"fulfillment_summary_1\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/sales_summary_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"sales_summary_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/sales_summary_2/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"sales_summary_2\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_fulfillment_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_fulfillment_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_sales_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_sales_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_sales_1/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_sales_1\")", + "WHERE id IS NULL", + "" + ], + "functions/sql/scaled_amount.sql": [ + "CREATE OR REPLACE FUNCTION analytics.scaled_amount(p_amount DOUBLE, p_factor INTEGER)", + "RETURNS DOUBLE", + "LANGUAGE SQL AS $$", + "p_amount * p_factor", + "$$", + "" + ], + "functions/sql/table_fn__amount_bands.sql": [ + "CREATE OR REPLACE FUNCTION analytics.table_fn__amount_bands(p_floor DOUBLE)", + "RETURNS TABLE (id INTEGER, band VARCHAR)", + "LANGUAGE SQL AS $$", + "SELECT CAST(id AS INTEGER) AS id,", + " CASE WHEN amount > p_floor THEN 'high' ELSE 'low' END AS band", + "FROM __ref(\"stg_fulfillment_0\")", + "$$", + "" + ], + "models/analysis/banded_amounts.sql": [ + "SELECT bands.id, bands.band", + "FROM __table_fn(\"table_fn__amount_bands\")(2.5) AS bands", + "" + ], + "models/analysis/chain_1_stg_sales_0.sql": [ + "SELECT id, label, amount", + "FROM __ref(\"contracted_stg_sales_0\")", + "" + ], + "models/analysis/chain_2_stg_sales_0.sql": [ + "SELECT id, UPPER(label) AS label, amount", + "FROM __ref(\"chain_1_stg_sales_0\")", + "" + ], + "models/analysis/chain_3_stg_sales_0.sql": [ + "SELECT id, label, amount", + "FROM __ref(\"chain_2_stg_sales_0\")", + "" + ], + "models/analysis/checked_stg_fulfillment_1.sql": [ + "SELECT id, amount, status", + "FROM __ref(\"stg_fulfillment_1\")", + "" + ], + "models/analysis/combined_stg_fulfillment_0.sql": [ + "WITH recent AS (", + " SELECT id, created_at FROM __ref(\"stg_fulfillment_0\") WHERE amount > 0", + "),", + "older AS (", + " SELECT id, created_at FROM __ref(\"stg_sales_1\")", + ")", + "SELECT id, created_at FROM recent", + "UNION ALL", + "SELECT id, created_at FROM older", + "" + ], + "models/analysis/contracted_stg_sales_0.sql": [ + "SELECT CAST(id AS INTEGER) AS id, CAST(status AS VARCHAR(19)) AS label,", + " amount", + "FROM __source(\"raw_events_0\")", + "" + ], + "models/analysis/every_open_event.sql": [ + "SELECT *", + "FROM __source(\"open_events\")", + "" + ], + "models/analysis/every_raw_events_0.sql": [ + "SELECT *", + "FROM __source(\"raw_events_0\")", + "" + ], + "models/analysis/every_stg_fulfillment_0.sql": [ + "SELECT *", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/analysis/passed_stg_fulfillment_0.sql": [ + "WITH passthrough AS (", + " SELECT id, created_at FROM __ref(\"stg_fulfillment_0\")", + ")", + "SELECT id, created_at", + "FROM passthrough", + "" + ], + "models/analysis/regional_stg_fulfillment_1.sql": [ + "SELECT id, amount, 'east' AS region", + "FROM __ref(\"stg_fulfillment_1\")", + "" + ], + "models/analysis/scaled_stg_fulfillment_0.sql": [ + "SELECT id, __udf(\"scaled_amount\")(amount, 2) AS scaled_amount", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/analysis/typed_stg_fulfillment_0.sql": [ + "SELECT id, amount * 2 AS doubled_amount, CAST(status AS VARCHAR) AS status_text,", + " created_at, NULL AS missing_note", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/analysis/unanalysed_stg_fulfillment_0.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_fulfillment_0\")", + "WHERE id = ANY [1, 2]", + "" + ], + "models/fulfillment/marts/fulfillment_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount * (1 - 1e-07)) AS adjust_2_amount,", + " j2.label AS lookup_label_2", + "FROM __ref(\"stg_fulfillment_0\") t", + "LEFT JOIN __ref(\"stg_sales_0\") j1 ON t.id = j1.id", + "LEFT JOIN __seed(\"lookup_1\") j2 ON t.id = j2.id", + "" + ], + "models/fulfillment/marts/fulfillment_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at", + "FROM __ref(\"stg_fulfillment_0\") t", + "" + ], + "models/fulfillment/marts/fulfillment_summary_2.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount * (1 - 1e-07)) AS adjust_2_amount,", + " j1.label AS lookup_label_1,", + " 'Zürich – depot' AS site_label", + "FROM __ref(\"stg_fulfillment_1\") t", + "LEFT JOIN __seed(\"lookup_0\") j1 ON t.id = j1.id", + "" + ], + "models/fulfillment/staging/stg_fulfillment_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " 'Zürich – depot' AS site_label", + "FROM __source(\"raw_events_1\") t", + "" + ], + "models/fulfillment/staging/stg_fulfillment_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'Ελληνικά orders' AS threshold_0_label,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_0_amount", + "FROM __source(\"raw_events_0\") t", + "WHERE t.status <> 'expédié'", + "" + ], + "models/sales/marts/sales_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'Ελληνικά orders' AS threshold_0_label,", + " j1.label AS lookup_label_1", + "FROM __ref(\"stg_sales_0\") t", + "LEFT JOIN __seed(\"lookup_1\") j1 ON t.id = j1.id", + "" + ], + "models/sales/marts/sales_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount * (1 - 1e-07)) AS adjust_2_amount,", + " j1.label AS lookup_label_1", + "FROM __ref(\"stg_sales_0\") t", + "LEFT JOIN __seed(\"lookup_0\") j1 ON t.id = j1.id", + "WHERE t.status <> '取消'", + "" + ], + "models/sales/marts/sales_summary_2.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'naïve résumé' AS threshold_1_label,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_0_amount,", + " j2.label AS lookup_label_2", + "FROM __ref(\"stg_sales_1\") t", + "LEFT JOIN __ref(\"stg_fulfillment_0\") j1 ON t.id = j1.id", + "LEFT JOIN __seed(\"lookup_1\") j2 ON t.id = j2.id", + "" + ], + "models/sales/staging/stg_sales_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * '1e-07' AS threshold_2_amount,", + " 'Zürich – depot' AS site_label", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/sales/staging/stg_sales_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'naïve résumé' AS threshold_1_label", + "FROM __source(\"raw_events_1\") t", + "" + ], + "tests/regional_stg_fulfillment_1/test_regional_stg_fulfillment_1.sql": [ + "WITH __ref__stg_fulfillment_1 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__regional_stg_fulfillment_1 AS (SELECT id, amount, 'west' AS region", + "FROM __ref__stg_fulfillment_1),", + "__actual__regional_stg_fulfillment_1 AS (SELECT * FROM __ref__regional_stg_fulfillment_1),", + "__expected__regional_stg_fulfillment_1 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'west' AS region)", + "SELECT 0 AS step_index, 'regional_stg_fulfillment_1' AS model_name, (SELECT COUNT(*) FROM __actual__regional_stg_fulfillment_1) AS actual_count, (SELECT COUNT(*) FROM __expected__regional_stg_fulfillment_1) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __actual__regional_stg_fulfillment_1 EXCEPT SELECT id, amount, region FROM __expected__regional_stg_fulfillment_1) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __expected__regional_stg_fulfillment_1 EXCEPT SELECT id, amount, region FROM __actual__regional_stg_fulfillment_1) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/stg_fulfillment_0/test_stg_fulfillment_0.sql": [ + "WITH __source__raw_events_1 AS (SELECT 1 AS id, CAST(10 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_fulfillment_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " 'Zürich – depot' AS site_label", + "FROM __source__raw_events_1 t),", + "__actual__stg_fulfillment_0 AS (SELECT * FROM __ref__stg_fulfillment_0),", + "__expected__stg_fulfillment_0 AS (SELECT 1 AS id, 'placed' AS status)", + "SELECT 0 AS step_index, 'stg_fulfillment_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_fulfillment_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_fulfillment_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __actual__stg_fulfillment_0 EXCEPT SELECT id, status FROM __expected__stg_fulfillment_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __expected__stg_fulfillment_0 EXCEPT SELECT id, status FROM __actual__stg_fulfillment_0) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.generated_0.banded_amounts": { + "database": null, + "schema": "analytics", + "name": "banded_amounts", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/banded_amounts.sql", + "original_file_path": "models/analysis/banded_amounts.sql", + "unique_id": "model.generated_0.banded_amounts", + "fqn": [ + "generated_0", + "models", + "analysis", + "banded_amounts" + ], + "alias": "banded_amounts", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Amount bands from a table function", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.banded_amounts", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.table_fn__amount_bands" + ] + } + }, + "model.generated_0.chain_1_stg_sales_0": { + "database": null, + "schema": "analytics", + "name": "chain_1_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/chain_1_stg_sales_0.sql", + "original_file_path": "models/analysis/chain_1_stg_sales_0.sql", + "unique_id": "model.generated_0.chain_1_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "chain_1_stg_sales_0" + ], + "alias": "chain_1_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Level 1 below the contracted copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.chain_1_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.contracted_stg_sales_0" + ] + } + }, + "model.generated_0.chain_2_stg_sales_0": { + "database": null, + "schema": "analytics", + "name": "chain_2_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/chain_2_stg_sales_0.sql", + "original_file_path": "models/analysis/chain_2_stg_sales_0.sql", + "unique_id": "model.generated_0.chain_2_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "chain_2_stg_sales_0" + ], + "alias": "chain_2_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Level 2 below the contracted copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.chain_2_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.chain_1_stg_sales_0" + ] + } + }, + "model.generated_0.chain_3_stg_sales_0": { + "database": null, + "schema": "analytics", + "name": "chain_3_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/chain_3_stg_sales_0.sql", + "original_file_path": "models/analysis/chain_3_stg_sales_0.sql", + "unique_id": "model.generated_0.chain_3_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "chain_3_stg_sales_0" + ], + "alias": "chain_3_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Level 3 below the contracted copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.chain_3_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.chain_2_stg_sales_0" + ] + } + }, + "model.generated_0.checked_stg_fulfillment_1": { + "database": null, + "schema": "analytics", + "name": "checked_stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/checked_stg_fulfillment_1.sql", + "original_file_path": "models/analysis/checked_stg_fulfillment_1.sql", + "unique_id": "model.generated_0.checked_stg_fulfillment_1", + "fqn": [ + "generated_0", + "models", + "analysis", + "checked_stg_fulfillment_1" + ], + "alias": "checked_stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Metadata-checked copy of stg_fulfillment_1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.checked_stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_1" + ] + } + }, + "model.generated_0.combined_stg_fulfillment_0": { + "database": null, + "schema": "analytics", + "name": "combined_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/combined_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/combined_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.combined_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "combined_stg_fulfillment_0" + ], + "alias": "combined_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Recent and older rows of stg_fulfillment_0 and stg_sales_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.combined_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0", + "model.generated_0.stg_sales_1" + ] + } + }, + "model.generated_0.contracted_stg_sales_0": { + "database": null, + "schema": "analytics", + "name": "contracted_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/contracted_stg_sales_0.sql", + "original_file_path": "models/analysis/contracted_stg_sales_0.sql", + "unique_id": "model.generated_0.contracted_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "contracted_stg_sales_0" + ], + "alias": "contracted_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Contracted copy of raw_events_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR(19)", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.contracted_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_0" + ] + } + }, + "model.generated_0.every_open_event": { + "database": null, + "schema": "analytics", + "name": "every_open_event", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/every_open_event.sql", + "original_file_path": "models/analysis/every_open_event.sql", + "unique_id": "model.generated_0.every_open_event", + "fqn": [ + "generated_0", + "models", + "analysis", + "every_open_event" + ], + "alias": "every_open_event", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Every column of an open source", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.every_open_event", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.open_events" + ] + } + }, + "model.generated_0.every_raw_events_0": { + "database": null, + "schema": "analytics", + "name": "every_raw_events_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/every_raw_events_0.sql", + "original_file_path": "models/analysis/every_raw_events_0.sql", + "unique_id": "model.generated_0.every_raw_events_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "every_raw_events_0" + ], + "alias": "every_raw_events_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Every column of raw_events_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.every_raw_events_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_0" + ] + } + }, + "model.generated_0.every_stg_fulfillment_0": { + "database": null, + "schema": "analytics", + "name": "every_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/every_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/every_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.every_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "every_stg_fulfillment_0" + ], + "alias": "every_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Every column of stg_fulfillment_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.every_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.passed_stg_fulfillment_0": { + "database": null, + "schema": "analytics", + "name": "passed_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/passed_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/passed_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.passed_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "passed_stg_fulfillment_0" + ], + "alias": "passed_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Columns of stg_fulfillment_0 passed through a CTE", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.passed_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.regional_stg_fulfillment_1": { + "database": null, + "schema": "analytics", + "name": "regional_stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/regional_stg_fulfillment_1.sql", + "original_file_path": "models/analysis/regional_stg_fulfillment_1.sql", + "unique_id": "model.generated_0.regional_stg_fulfillment_1", + "fqn": [ + "generated_0", + "models", + "analysis", + "regional_stg_fulfillment_1" + ], + "alias": "regional_stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Regional copy of stg_fulfillment_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.regional_stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_1" + ] + } + }, + "model.generated_0.scaled_stg_fulfillment_0": { + "database": null, + "schema": "analytics", + "name": "scaled_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/scaled_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/scaled_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.scaled_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "scaled_stg_fulfillment_0" + ], + "alias": "scaled_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Scaled amounts of stg_fulfillment_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.scaled_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.scaled_amount", + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.typed_stg_fulfillment_0": { + "database": null, + "schema": "analytics", + "name": "typed_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/typed_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/typed_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.typed_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "typed_stg_fulfillment_0" + ], + "alias": "typed_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Typed and untyped outputs of stg_fulfillment_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.typed_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.unanalysed_stg_fulfillment_0": { + "database": null, + "schema": "analytics", + "name": "unanalysed_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/unanalysed_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/unanalysed_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.unanalysed_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "unanalysed_stg_fulfillment_0" + ], + "alias": "unanalysed_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Copy of stg_fulfillment_0 that SQL analysis cannot parse", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.unanalysed_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.fulfillment_summary_0": { + "database": null, + "schema": "analytics", + "name": "fulfillment_summary_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/marts/fulfillment_summary_0.sql", + "original_file_path": "models/fulfillment/marts/fulfillment_summary_0.sql", + "unique_id": "model.generated_0.fulfillment_summary_0", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "marts", + "fulfillment_summary_0" + ], + "alias": "fulfillment_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of fulfillment activity 0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.fulfillment_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0", + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_1" + ] + } + }, + "model.generated_0.fulfillment_summary_1": { + "database": null, + "schema": "analytics", + "name": "fulfillment_summary_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/marts/fulfillment_summary_1.sql", + "original_file_path": "models/fulfillment/marts/fulfillment_summary_1.sql", + "unique_id": "model.generated_0.fulfillment_summary_1", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "marts", + "fulfillment_summary_1" + ], + "alias": "fulfillment_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'analytics.fulfillment_summary_1' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'analytics.fulfillment_summary_1' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of fulfillment activity 1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'analytics.fulfillment_summary_1' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "Ελληνικά orders" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'analytics.fulfillment_summary_1' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.fulfillment_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.fulfillment_summary_2": { + "database": null, + "schema": "analytics", + "name": "fulfillment_summary_2", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/marts/fulfillment_summary_2.sql", + "original_file_path": "models/fulfillment/marts/fulfillment_summary_2.sql", + "unique_id": "model.generated_0.fulfillment_summary_2", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "marts", + "fulfillment_summary_2" + ], + "alias": "fulfillment_summary_2", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'analytics.fulfillment_summary_2' AS refreshed_relation, 'café ☕ counter' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'analytics.fulfillment_summary_2' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of fulfillment activity 2 (naïve résumé)", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'analytics.fulfillment_summary_2' AS refreshed_relation, 'café ☕ counter' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "café ☕ counter" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'analytics.fulfillment_summary_2' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.fulfillment_summary_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_1", + "seed.generated_0.lookup_0" + ] + } + }, + "model.generated_0.stg_fulfillment_0": { + "database": null, + "schema": "analytics", + "name": "stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/staging/stg_fulfillment_0.sql", + "original_file_path": "models/fulfillment/staging/stg_fulfillment_0.sql", + "unique_id": "model.generated_0.stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "staging", + "stg_fulfillment_0" + ], + "alias": "stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged fulfillment events 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_1" + ] + } + }, + "model.generated_0.stg_fulfillment_1": { + "database": null, + "schema": "analytics", + "name": "stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/staging/stg_fulfillment_1.sql", + "original_file_path": "models/fulfillment/staging/stg_fulfillment_1.sql", + "unique_id": "model.generated_0.stg_fulfillment_1", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "staging", + "stg_fulfillment_1" + ], + "alias": "stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged fulfillment events 1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_0" + ] + } + }, + "model.generated_0.sales_summary_0": { + "database": null, + "schema": "analytics", + "name": "sales_summary_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/marts/sales_summary_0.sql", + "original_file_path": "models/sales/marts/sales_summary_0.sql", + "unique_id": "model.generated_0.sales_summary_0", + "fqn": [ + "generated_0", + "models", + "sales", + "marts", + "sales_summary_0" + ], + "alias": "sales_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [ + "sales", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "sales", + "marts" + ], + "description": "Summary of sales activity 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.sales_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_1" + ] + } + }, + "model.generated_0.sales_summary_1": { + "database": null, + "schema": "analytics", + "name": "sales_summary_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/marts/sales_summary_1.sql", + "original_file_path": "models/sales/marts/sales_summary_1.sql", + "unique_id": "model.generated_0.sales_summary_1", + "fqn": [ + "generated_0", + "models", + "sales", + "marts", + "sales_summary_1" + ], + "alias": "sales_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [ + "sales", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'analytics.sales_summary_1' AS refreshed_relation, '東京 warehouse' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'analytics.sales_summary_1' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "sales", + "marts" + ], + "description": "Summary of sales activity 1", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'analytics.sales_summary_1' AS refreshed_relation, '東京 warehouse' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "東京 warehouse" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'analytics.sales_summary_1' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.sales_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_0" + ] + } + }, + "model.generated_0.sales_summary_2": { + "database": null, + "schema": "analytics", + "name": "sales_summary_2", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/marts/sales_summary_2.sql", + "original_file_path": "models/sales/marts/sales_summary_2.sql", + "unique_id": "model.generated_0.sales_summary_2", + "fqn": [ + "generated_0", + "models", + "sales", + "marts", + "sales_summary_2" + ], + "alias": "sales_summary_2", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [ + "sales", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "sales", + "marts" + ], + "description": "Summary of sales activity 2 (Ελληνικά orders)", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.sales_summary_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_1", + "model.generated_0.stg_fulfillment_0", + "seed.generated_0.lookup_1" + ] + } + }, + "model.generated_0.stg_sales_0": { + "database": null, + "schema": "analytics", + "name": "stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/staging/stg_sales_0.sql", + "original_file_path": "models/sales/staging/stg_sales_0.sql", + "unique_id": "model.generated_0.stg_sales_0", + "fqn": [ + "generated_0", + "models", + "sales", + "staging", + "stg_sales_0" + ], + "alias": "stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged sales events 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_0" + ] + } + }, + "model.generated_0.stg_sales_1": { + "database": null, + "schema": "analytics", + "name": "stg_sales_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/staging/stg_sales_1.sql", + "original_file_path": "models/sales/staging/stg_sales_1.sql", + "unique_id": "model.generated_0.stg_sales_1", + "fqn": [ + "generated_0", + "models", + "sales", + "staging", + "stg_sales_1" + ], + "alias": "stg_sales_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged sales events 1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.stg_sales_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_1" + ] + } + }, + "seed.generated_0.lookup_0": { + "database": null, + "schema": "analytics", + "name": "lookup_0", + "resource_type": "seed", + "package_name": "generated_0", + "path": "seeds/lookup_0.csv", + "original_file_path": "seeds/lookup_0.csv", + "unique_id": "seed.generated_0.lookup_0", + "fqn": [ + "generated_0", + "seeds", + "lookup_0" + ], + "alias": "lookup_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "seed", + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + }, + "delimiter": ",", + "quote_columns": null + }, + "tags": [], + "description": "Generated lookup 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.lookup_0", + "root_path": null, + "depends_on": { + "macros": [] + } + }, + "seed.generated_0.lookup_1": { + "database": null, + "schema": "analytics", + "name": "lookup_1", + "resource_type": "seed", + "package_name": "generated_0", + "path": "seeds/lookup_1.csv", + "original_file_path": "seeds/lookup_1.csv", + "unique_id": "seed.generated_0.lookup_1", + "fqn": [ + "generated_0", + "seeds", + "lookup_1" + ], + "alias": "lookup_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "seed", + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + }, + "delimiter": ",", + "quote_columns": null + }, + "tags": [], + "description": "Generated lookup 1.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "analytics.lookup_1", + "root_path": null, + "depends_on": { + "macros": [] + } + } + }, + "sources": { + "source.generated_0.open_events": { + "database": null, + "schema": "", + "name": "open_events", + "resource_type": "source", + "package_name": "generated_0", + "path": "sources/open.yml", + "original_file_path": "sources/open.yml", + "unique_id": "source.generated_0.open_events", + "fqn": [ + "generated_0", + "open_events" + ], + "source_name": "open_events", + "source_description": "", + "loader": "", + "identifier": "open_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Events whose columns are only known to the warehouse.", + "columns": {}, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_0.raw_events_0": { + "database": null, + "schema": "", + "name": "raw_events_0", + "resource_type": "source", + "package_name": "generated_0", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_0.raw_events_0", + "fqn": [ + "generated_0", + "raw_events_0" + ], + "source_name": "raw_events_0", + "source_description": "", + "loader": "", + "identifier": "raw_events_0", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_0.raw_events_1": { + "database": null, + "schema": "", + "name": "raw_events_1", + "resource_type": "source", + "package_name": "generated_0", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_0.raw_events_1", + "fqn": [ + "generated_0", + "raw_events_1" + ], + "source_name": "raw_events_1", + "source_description": "", + "loader": "", + "identifier": "raw_events_1", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 1.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.generated_0.adjust_0": { + "name": "adjust_0", + "resource_type": "macro", + "package_name": "generated_0", + "path": "macros/adjust_0.py", + "original_file_path": "macros/adjust_0.py", + "unique_id": "macro.generated_0.adjust_0", + "macro_sql": "def adjust_0_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_0(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_0_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [ + "macro.generated_0.adjust_0_round" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.adjust_0_round": { + "name": "adjust_0_round", + "resource_type": "macro", + "package_name": "generated_0", + "path": "macros/adjust_0.py", + "original_file_path": "macros/adjust_0.py", + "unique_id": "macro.generated_0.adjust_0_round", + "macro_sql": "def adjust_0_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_0(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_0_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.adjust_2": { + "name": "adjust_2", + "resource_type": "macro", + "package_name": "generated_0", + "path": "macros/adjust_2.py", + "original_file_path": "macros/adjust_2.py", + "unique_id": "macro.generated_0.adjust_2", + "macro_sql": "def adjust_2(ctx, expression: str) -> str:\n \"\"\"Scale an amount by the configured discount.\"\"\"\n rate = ctx.vars[\"discount_rate\"]\n return f\"({expression} * (1 - {rate}))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.analysis_region": { + "name": "analysis_region", + "resource_type": "macro", + "package_name": "generated_0", + "path": "models/analysis/_sqlbuild/_macros/regions.py", + "original_file_path": "models/analysis/_sqlbuild/_macros/regions.py", + "unique_id": "macro.generated_0.analysis_region", + "macro_sql": "def analysis_region() -> str:\n \"\"\"Return the region rows are assigned to.\"\"\"\n return \"'east'\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/analysis" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.adjust_1": { + "name": "adjust_1", + "resource_type": "macro", + "package_name": "generated_0", + "path": "models/fulfillment/staging/_sqlbuild/_macros/adjust_1.py", + "original_file_path": "models/fulfillment/staging/_sqlbuild/_macros/adjust_1.py", + "unique_id": "macro.generated_0.adjust_1", + "macro_sql": "import os\n\n\ndef adjust_1(expression: str) -> str:\n \"\"\"Tag an amount with the deployment region.\"\"\"\n region = os.environ.get(\"SQB_DIFFERENTIAL_REGION\", \"east\")\n return f\"({expression} + LENGTH('{region}'))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/fulfillment/staging" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0__sqlbuild_hooks.record_refresh": { + "name": "record_refresh", + "resource_type": "macro", + "package_name": "generated_0__sqlbuild_hooks", + "path": "hooks/sql/record_refresh.sql", + "original_file_path": "hooks/sql/record_refresh.sql", + "unique_id": "macro.generated_0__sqlbuild_hooks.record_refresh", + "macro_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "depends_on": { + "macros": [] + }, + "description": "Record a refresh for one relation", + "meta": { + "sqlbuild_resource_type": "sql_hook", + "sqlbuild_hook_name": "record_refresh" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.generated_0.banded_amounts": [ + "model.generated_0.table_fn__amount_bands" + ], + "model.generated_0.chain_1_stg_sales_0": [ + "model.generated_0.contracted_stg_sales_0" + ], + "model.generated_0.chain_2_stg_sales_0": [ + "model.generated_0.chain_1_stg_sales_0" + ], + "model.generated_0.chain_3_stg_sales_0": [ + "model.generated_0.chain_2_stg_sales_0" + ], + "model.generated_0.checked_stg_fulfillment_1": [ + "model.generated_0.stg_fulfillment_1" + ], + "model.generated_0.combined_stg_fulfillment_0": [ + "model.generated_0.stg_fulfillment_0", + "model.generated_0.stg_sales_1" + ], + "model.generated_0.contracted_stg_sales_0": [ + "source.generated_0.raw_events_0" + ], + "model.generated_0.every_open_event": [ + "source.generated_0.open_events" + ], + "model.generated_0.every_raw_events_0": [ + "source.generated_0.raw_events_0" + ], + "model.generated_0.every_stg_fulfillment_0": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.passed_stg_fulfillment_0": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.regional_stg_fulfillment_1": [ + "model.generated_0.stg_fulfillment_1" + ], + "model.generated_0.scaled_stg_fulfillment_0": [ + "model.generated_0.scaled_amount", + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.typed_stg_fulfillment_0": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.unanalysed_stg_fulfillment_0": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.fulfillment_summary_0": [ + "model.generated_0.stg_fulfillment_0", + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_1" + ], + "model.generated_0.fulfillment_summary_1": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.fulfillment_summary_2": [ + "model.generated_0.stg_fulfillment_1", + "seed.generated_0.lookup_0" + ], + "model.generated_0.stg_fulfillment_0": [ + "source.generated_0.raw_events_1" + ], + "model.generated_0.stg_fulfillment_1": [ + "source.generated_0.raw_events_0" + ], + "model.generated_0.sales_summary_0": [ + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_1" + ], + "model.generated_0.sales_summary_1": [ + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_0" + ], + "model.generated_0.sales_summary_2": [ + "model.generated_0.stg_sales_1", + "model.generated_0.stg_fulfillment_0", + "seed.generated_0.lookup_1" + ], + "model.generated_0.stg_sales_0": [ + "source.generated_0.raw_events_0" + ], + "model.generated_0.stg_sales_1": [ + "source.generated_0.raw_events_1" + ], + "source.generated_0.open_events": [], + "source.generated_0.raw_events_0": [], + "source.generated_0.raw_events_1": [], + "seed.generated_0.lookup_0": [], + "seed.generated_0.lookup_1": [], + "model.generated_0.scaled_amount": [], + "model.generated_0.table_fn__amount_bands": [ + "model.generated_0.stg_fulfillment_0" + ] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/seed/0-snowflake.json b/tests/goldens/compiler/seed/0-snowflake.json new file mode 100644 index 0000000000..86d39efb09 --- /dev/null +++ b/tests/goldens/compiler/seed/0-snowflake.json @@ -0,0 +1,2907 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "audits/generic/checked_stg_fulfillment_1/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"checked_stg_fulfillment_1\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'expédié', '取消', 'returned ✓')", + "" + ], + "audits/generic/checked_stg_fulfillment_1/expression_is_true.sql": [ + "SELECT *", + "FROM __ref(\"checked_stg_fulfillment_1\")", + "WHERE NOT (amount >= -1000)", + "" + ], + "audits/generic/checked_stg_fulfillment_1/relationships__id.sql": [ + "SELECT id", + "FROM __ref(\"checked_stg_fulfillment_1\")", + "WHERE id IS NOT NULL", + " AND id NOT IN (", + " SELECT id", + " FROM __ref(\"stg_fulfillment_1\")", + " WHERE id IS NOT NULL", + " )", + "" + ], + "audits/generic/fulfillment_summary_1/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"fulfillment_summary_1\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/sales_summary_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"sales_summary_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/sales_summary_2/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"sales_summary_2\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_fulfillment_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_fulfillment_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_sales_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_sales_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_sales_1/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_sales_1\")", + "WHERE id IS NULL", + "" + ], + "functions/sql/scaled_amount.sql": [ + "CREATE OR REPLACE FUNCTION GENERATED.analytics.scaled_amount(p_amount DOUBLE, p_factor INTEGER)", + "RETURNS DOUBLE", + "LANGUAGE SQL", + "AS $$", + "p_amount * p_factor", + "$$", + "" + ], + "functions/sql/table_fn__amount_bands.sql": [ + "CREATE OR REPLACE FUNCTION GENERATED.analytics.table_fn__amount_bands(p_floor DOUBLE)", + "RETURNS TABLE (id INTEGER, band VARCHAR)", + "AS $$", + "SELECT CAST(id AS INTEGER) AS id,", + " CASE WHEN amount > p_floor THEN 'high' ELSE 'low' END AS band", + "FROM __ref(\"stg_fulfillment_0\")", + "$$", + "" + ], + "models/analysis/banded_amounts.sql": [ + "SELECT bands.id, bands.band", + "FROM __table_fn(\"table_fn__amount_bands\")(2.5) AS bands", + "" + ], + "models/analysis/chain_1_stg_sales_0.sql": [ + "SELECT id, label, amount", + "FROM __ref(\"contracted_stg_sales_0\")", + "" + ], + "models/analysis/chain_2_stg_sales_0.sql": [ + "SELECT id, UPPER(label) AS label, amount", + "FROM __ref(\"chain_1_stg_sales_0\")", + "" + ], + "models/analysis/chain_3_stg_sales_0.sql": [ + "SELECT id, label, amount", + "FROM __ref(\"chain_2_stg_sales_0\")", + "" + ], + "models/analysis/checked_stg_fulfillment_1.sql": [ + "SELECT id, amount, status", + "FROM __ref(\"stg_fulfillment_1\")", + "" + ], + "models/analysis/combined_stg_fulfillment_0.sql": [ + "WITH recent AS (", + " SELECT id, created_at FROM __ref(\"stg_fulfillment_0\") WHERE amount > 0", + "),", + "older AS (", + " SELECT id, created_at FROM __ref(\"stg_sales_1\")", + ")", + "SELECT id, created_at FROM recent", + "UNION ALL", + "SELECT id, created_at FROM older", + "" + ], + "models/analysis/contracted_stg_sales_0.sql": [ + "SELECT CAST(id AS INTEGER) AS id, CAST(status AS VARCHAR(19)) AS label,", + " amount", + "FROM __source(\"raw_events_0\")", + "" + ], + "models/analysis/every_open_event.sql": [ + "SELECT *", + "FROM __source(\"open_events\")", + "" + ], + "models/analysis/every_raw_events_0.sql": [ + "SELECT *", + "FROM __source(\"raw_events_0\")", + "" + ], + "models/analysis/every_stg_fulfillment_0.sql": [ + "SELECT *", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/analysis/passed_stg_fulfillment_0.sql": [ + "WITH passthrough AS (", + " SELECT id, created_at FROM __ref(\"stg_fulfillment_0\")", + ")", + "SELECT id, created_at", + "FROM passthrough", + "" + ], + "models/analysis/regional_stg_fulfillment_1.sql": [ + "SELECT id, amount, 'east' AS region", + "FROM __ref(\"stg_fulfillment_1\")", + "" + ], + "models/analysis/scaled_stg_fulfillment_0.sql": [ + "SELECT id, __udf(\"scaled_amount\")(amount, 2) AS scaled_amount", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/analysis/typed_stg_fulfillment_0.sql": [ + "SELECT id, amount * 2 AS doubled_amount, CAST(status AS VARCHAR) AS status_text,", + " created_at, NULL AS missing_note", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/analysis/unanalysed_stg_fulfillment_0.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_fulfillment_0\")", + "WHERE id = ANY [1, 2]", + "" + ], + "models/fulfillment/marts/fulfillment_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount * (1 - 1e-07)) AS adjust_2_amount,", + " j2.label AS lookup_label_2", + "FROM __ref(\"stg_fulfillment_0\") t", + "LEFT JOIN __ref(\"stg_sales_0\") j1 ON t.id = j1.id", + "LEFT JOIN __seed(\"lookup_1\") j2 ON t.id = j2.id", + "" + ], + "models/fulfillment/marts/fulfillment_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at", + "FROM __ref(\"stg_fulfillment_0\") t", + "" + ], + "models/fulfillment/marts/fulfillment_summary_2.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount * (1 - 1e-07)) AS adjust_2_amount,", + " j1.label AS lookup_label_1,", + " 'Zürich – depot' AS site_label", + "FROM __ref(\"stg_fulfillment_1\") t", + "LEFT JOIN __seed(\"lookup_0\") j1 ON t.id = j1.id", + "" + ], + "models/fulfillment/staging/stg_fulfillment_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " 'Zürich – depot' AS site_label", + "FROM __source(\"raw_events_1\") t", + "" + ], + "models/fulfillment/staging/stg_fulfillment_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'Ελληνικά orders' AS threshold_0_label,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_0_amount", + "FROM __source(\"raw_events_0\") t", + "WHERE t.status <> 'expédié'", + "" + ], + "models/sales/marts/sales_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'Ελληνικά orders' AS threshold_0_label,", + " j1.label AS lookup_label_1", + "FROM __ref(\"stg_sales_0\") t", + "LEFT JOIN __seed(\"lookup_1\") j1 ON t.id = j1.id", + "" + ], + "models/sales/marts/sales_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount * (1 - 1e-07)) AS adjust_2_amount,", + " j1.label AS lookup_label_1", + "FROM __ref(\"stg_sales_0\") t", + "LEFT JOIN __seed(\"lookup_0\") j1 ON t.id = j1.id", + "WHERE t.status <> '取消'", + "" + ], + "models/sales/marts/sales_summary_2.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'naïve résumé' AS threshold_1_label,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_0_amount,", + " j2.label AS lookup_label_2", + "FROM __ref(\"stg_sales_1\") t", + "LEFT JOIN __ref(\"stg_fulfillment_0\") j1 ON t.id = j1.id", + "LEFT JOIN __seed(\"lookup_1\") j2 ON t.id = j2.id", + "" + ], + "models/sales/staging/stg_sales_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * '1e-07' AS threshold_2_amount,", + " 'Zürich – depot' AS site_label", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/sales/staging/stg_sales_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'naïve résumé' AS threshold_1_label", + "FROM __source(\"raw_events_1\") t", + "" + ], + "tests/regional_stg_fulfillment_1/test_regional_stg_fulfillment_1.sql": [ + "WITH __ref__stg_fulfillment_1 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__regional_stg_fulfillment_1 AS (SELECT id, amount, 'west' AS region", + "FROM __ref__stg_fulfillment_1),", + "__actual__regional_stg_fulfillment_1 AS (SELECT * FROM __ref__regional_stg_fulfillment_1),", + "__expected__regional_stg_fulfillment_1 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'west' AS region)", + "SELECT 0 AS step_index, 'regional_stg_fulfillment_1' AS model_name, (SELECT COUNT(*) FROM __actual__regional_stg_fulfillment_1) AS actual_count, (SELECT COUNT(*) FROM __expected__regional_stg_fulfillment_1) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __actual__regional_stg_fulfillment_1 EXCEPT SELECT id, amount, region FROM __expected__regional_stg_fulfillment_1) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __expected__regional_stg_fulfillment_1 EXCEPT SELECT id, amount, region FROM __actual__regional_stg_fulfillment_1) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/stg_fulfillment_0/test_stg_fulfillment_0.sql": [ + "WITH __source__raw_events_1 AS (SELECT 1 AS id, CAST(10 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_fulfillment_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " 'Zürich – depot' AS site_label", + "FROM __source__raw_events_1 t),", + "__actual__stg_fulfillment_0 AS (SELECT * FROM __ref__stg_fulfillment_0),", + "__expected__stg_fulfillment_0 AS (SELECT 1 AS id, 'placed' AS status)", + "SELECT 0 AS step_index, 'stg_fulfillment_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_fulfillment_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_fulfillment_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __actual__stg_fulfillment_0 EXCEPT SELECT id, status FROM __expected__stg_fulfillment_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __expected__stg_fulfillment_0 EXCEPT SELECT id, status FROM __actual__stg_fulfillment_0) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.generated_0.banded_amounts": { + "database": "GENERATED", + "schema": "analytics", + "name": "banded_amounts", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/banded_amounts.sql", + "original_file_path": "models/analysis/banded_amounts.sql", + "unique_id": "model.generated_0.banded_amounts", + "fqn": [ + "generated_0", + "models", + "analysis", + "banded_amounts" + ], + "alias": "banded_amounts", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Amount bands from a table function", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.banded_amounts", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.table_fn__amount_bands" + ] + } + }, + "model.generated_0.chain_1_stg_sales_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "chain_1_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/chain_1_stg_sales_0.sql", + "original_file_path": "models/analysis/chain_1_stg_sales_0.sql", + "unique_id": "model.generated_0.chain_1_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "chain_1_stg_sales_0" + ], + "alias": "chain_1_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Level 1 below the contracted copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.chain_1_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.contracted_stg_sales_0" + ] + } + }, + "model.generated_0.chain_2_stg_sales_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "chain_2_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/chain_2_stg_sales_0.sql", + "original_file_path": "models/analysis/chain_2_stg_sales_0.sql", + "unique_id": "model.generated_0.chain_2_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "chain_2_stg_sales_0" + ], + "alias": "chain_2_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Level 2 below the contracted copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.chain_2_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.chain_1_stg_sales_0" + ] + } + }, + "model.generated_0.chain_3_stg_sales_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "chain_3_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/chain_3_stg_sales_0.sql", + "original_file_path": "models/analysis/chain_3_stg_sales_0.sql", + "unique_id": "model.generated_0.chain_3_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "chain_3_stg_sales_0" + ], + "alias": "chain_3_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Level 3 below the contracted copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.chain_3_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.chain_2_stg_sales_0" + ] + } + }, + "model.generated_0.checked_stg_fulfillment_1": { + "database": "GENERATED", + "schema": "analytics", + "name": "checked_stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/checked_stg_fulfillment_1.sql", + "original_file_path": "models/analysis/checked_stg_fulfillment_1.sql", + "unique_id": "model.generated_0.checked_stg_fulfillment_1", + "fqn": [ + "generated_0", + "models", + "analysis", + "checked_stg_fulfillment_1" + ], + "alias": "checked_stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Metadata-checked copy of stg_fulfillment_1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.checked_stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_1" + ] + } + }, + "model.generated_0.combined_stg_fulfillment_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "combined_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/combined_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/combined_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.combined_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "combined_stg_fulfillment_0" + ], + "alias": "combined_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Recent and older rows of stg_fulfillment_0 and stg_sales_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.combined_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0", + "model.generated_0.stg_sales_1" + ] + } + }, + "model.generated_0.contracted_stg_sales_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "contracted_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/contracted_stg_sales_0.sql", + "original_file_path": "models/analysis/contracted_stg_sales_0.sql", + "unique_id": "model.generated_0.contracted_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "contracted_stg_sales_0" + ], + "alias": "contracted_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Contracted copy of raw_events_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR(19)", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.contracted_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_0" + ] + } + }, + "model.generated_0.every_open_event": { + "database": "GENERATED", + "schema": "analytics", + "name": "every_open_event", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/every_open_event.sql", + "original_file_path": "models/analysis/every_open_event.sql", + "unique_id": "model.generated_0.every_open_event", + "fqn": [ + "generated_0", + "models", + "analysis", + "every_open_event" + ], + "alias": "every_open_event", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Every column of an open source", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.every_open_event", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.open_events" + ] + } + }, + "model.generated_0.every_raw_events_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "every_raw_events_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/every_raw_events_0.sql", + "original_file_path": "models/analysis/every_raw_events_0.sql", + "unique_id": "model.generated_0.every_raw_events_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "every_raw_events_0" + ], + "alias": "every_raw_events_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Every column of raw_events_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.every_raw_events_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_0" + ] + } + }, + "model.generated_0.every_stg_fulfillment_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "every_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/every_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/every_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.every_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "every_stg_fulfillment_0" + ], + "alias": "every_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Every column of stg_fulfillment_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.every_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.passed_stg_fulfillment_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "passed_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/passed_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/passed_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.passed_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "passed_stg_fulfillment_0" + ], + "alias": "passed_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Columns of stg_fulfillment_0 passed through a CTE", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.passed_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.regional_stg_fulfillment_1": { + "database": "GENERATED", + "schema": "analytics", + "name": "regional_stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/regional_stg_fulfillment_1.sql", + "original_file_path": "models/analysis/regional_stg_fulfillment_1.sql", + "unique_id": "model.generated_0.regional_stg_fulfillment_1", + "fqn": [ + "generated_0", + "models", + "analysis", + "regional_stg_fulfillment_1" + ], + "alias": "regional_stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Regional copy of stg_fulfillment_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.regional_stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_1" + ] + } + }, + "model.generated_0.scaled_stg_fulfillment_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "scaled_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/scaled_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/scaled_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.scaled_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "scaled_stg_fulfillment_0" + ], + "alias": "scaled_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Scaled amounts of stg_fulfillment_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.scaled_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.scaled_amount", + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.typed_stg_fulfillment_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "typed_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/typed_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/typed_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.typed_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "typed_stg_fulfillment_0" + ], + "alias": "typed_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Typed and untyped outputs of stg_fulfillment_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.typed_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.unanalysed_stg_fulfillment_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "unanalysed_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/unanalysed_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/unanalysed_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.unanalysed_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "unanalysed_stg_fulfillment_0" + ], + "alias": "unanalysed_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Copy of stg_fulfillment_0 that SQL analysis cannot parse", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.unanalysed_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.fulfillment_summary_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "fulfillment_summary_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/marts/fulfillment_summary_0.sql", + "original_file_path": "models/fulfillment/marts/fulfillment_summary_0.sql", + "unique_id": "model.generated_0.fulfillment_summary_0", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "marts", + "fulfillment_summary_0" + ], + "alias": "fulfillment_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of fulfillment activity 0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.fulfillment_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0", + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_1" + ] + } + }, + "model.generated_0.fulfillment_summary_1": { + "database": "GENERATED", + "schema": "analytics", + "name": "fulfillment_summary_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/marts/fulfillment_summary_1.sql", + "original_file_path": "models/fulfillment/marts/fulfillment_summary_1.sql", + "unique_id": "model.generated_0.fulfillment_summary_1", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "marts", + "fulfillment_summary_1" + ], + "alias": "fulfillment_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'GENERATED.analytics.fulfillment_summary_1' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'GENERATED.analytics.fulfillment_summary_1' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of fulfillment activity 1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'GENERATED.analytics.fulfillment_summary_1' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "Ελληνικά orders" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'GENERATED.analytics.fulfillment_summary_1' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.fulfillment_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.fulfillment_summary_2": { + "database": "GENERATED", + "schema": "analytics", + "name": "fulfillment_summary_2", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/marts/fulfillment_summary_2.sql", + "original_file_path": "models/fulfillment/marts/fulfillment_summary_2.sql", + "unique_id": "model.generated_0.fulfillment_summary_2", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "marts", + "fulfillment_summary_2" + ], + "alias": "fulfillment_summary_2", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'GENERATED.analytics.fulfillment_summary_2' AS refreshed_relation, 'café ☕ counter' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'GENERATED.analytics.fulfillment_summary_2' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of fulfillment activity 2 (naïve résumé)", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'GENERATED.analytics.fulfillment_summary_2' AS refreshed_relation, 'café ☕ counter' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "café ☕ counter" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'GENERATED.analytics.fulfillment_summary_2' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.fulfillment_summary_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_1", + "seed.generated_0.lookup_0" + ] + } + }, + "model.generated_0.stg_fulfillment_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/staging/stg_fulfillment_0.sql", + "original_file_path": "models/fulfillment/staging/stg_fulfillment_0.sql", + "unique_id": "model.generated_0.stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "staging", + "stg_fulfillment_0" + ], + "alias": "stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged fulfillment events 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_1" + ] + } + }, + "model.generated_0.stg_fulfillment_1": { + "database": "GENERATED", + "schema": "analytics", + "name": "stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/staging/stg_fulfillment_1.sql", + "original_file_path": "models/fulfillment/staging/stg_fulfillment_1.sql", + "unique_id": "model.generated_0.stg_fulfillment_1", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "staging", + "stg_fulfillment_1" + ], + "alias": "stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged fulfillment events 1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_0" + ] + } + }, + "model.generated_0.sales_summary_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "sales_summary_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/marts/sales_summary_0.sql", + "original_file_path": "models/sales/marts/sales_summary_0.sql", + "unique_id": "model.generated_0.sales_summary_0", + "fqn": [ + "generated_0", + "models", + "sales", + "marts", + "sales_summary_0" + ], + "alias": "sales_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [ + "sales", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "sales", + "marts" + ], + "description": "Summary of sales activity 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.sales_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_1" + ] + } + }, + "model.generated_0.sales_summary_1": { + "database": "GENERATED", + "schema": "analytics", + "name": "sales_summary_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/marts/sales_summary_1.sql", + "original_file_path": "models/sales/marts/sales_summary_1.sql", + "unique_id": "model.generated_0.sales_summary_1", + "fqn": [ + "generated_0", + "models", + "sales", + "marts", + "sales_summary_1" + ], + "alias": "sales_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [ + "sales", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'GENERATED.analytics.sales_summary_1' AS refreshed_relation, '東京 warehouse' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'GENERATED.analytics.sales_summary_1' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "sales", + "marts" + ], + "description": "Summary of sales activity 1", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'GENERATED.analytics.sales_summary_1' AS refreshed_relation, '東京 warehouse' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "東京 warehouse" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'GENERATED.analytics.sales_summary_1' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.sales_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_0" + ] + } + }, + "model.generated_0.sales_summary_2": { + "database": "GENERATED", + "schema": "analytics", + "name": "sales_summary_2", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/marts/sales_summary_2.sql", + "original_file_path": "models/sales/marts/sales_summary_2.sql", + "unique_id": "model.generated_0.sales_summary_2", + "fqn": [ + "generated_0", + "models", + "sales", + "marts", + "sales_summary_2" + ], + "alias": "sales_summary_2", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [ + "sales", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "sales", + "marts" + ], + "description": "Summary of sales activity 2 (Ελληνικά orders)", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.sales_summary_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_1", + "model.generated_0.stg_fulfillment_0", + "seed.generated_0.lookup_1" + ] + } + }, + "model.generated_0.stg_sales_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/staging/stg_sales_0.sql", + "original_file_path": "models/sales/staging/stg_sales_0.sql", + "unique_id": "model.generated_0.stg_sales_0", + "fqn": [ + "generated_0", + "models", + "sales", + "staging", + "stg_sales_0" + ], + "alias": "stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged sales events 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_0" + ] + } + }, + "model.generated_0.stg_sales_1": { + "database": "GENERATED", + "schema": "analytics", + "name": "stg_sales_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/staging/stg_sales_1.sql", + "original_file_path": "models/sales/staging/stg_sales_1.sql", + "unique_id": "model.generated_0.stg_sales_1", + "fqn": [ + "generated_0", + "models", + "sales", + "staging", + "stg_sales_1" + ], + "alias": "stg_sales_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged sales events 1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.stg_sales_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_1" + ] + } + }, + "seed.generated_0.lookup_0": { + "database": "GENERATED", + "schema": "analytics", + "name": "lookup_0", + "resource_type": "seed", + "package_name": "generated_0", + "path": "seeds/lookup_0.csv", + "original_file_path": "seeds/lookup_0.csv", + "unique_id": "seed.generated_0.lookup_0", + "fqn": [ + "generated_0", + "seeds", + "lookup_0" + ], + "alias": "lookup_0", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "seed", + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + }, + "delimiter": ",", + "quote_columns": null + }, + "tags": [], + "description": "Generated lookup 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.lookup_0", + "root_path": null, + "depends_on": { + "macros": [] + } + }, + "seed.generated_0.lookup_1": { + "database": "GENERATED", + "schema": "analytics", + "name": "lookup_1", + "resource_type": "seed", + "package_name": "generated_0", + "path": "seeds/lookup_1.csv", + "original_file_path": "seeds/lookup_1.csv", + "unique_id": "seed.generated_0.lookup_1", + "fqn": [ + "generated_0", + "seeds", + "lookup_1" + ], + "alias": "lookup_1", + "config": { + "enabled": true, + "alias": null, + "schema": "analytics", + "database": "GENERATED", + "tags": [], + "meta": {}, + "group": null, + "materialized": "seed", + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + }, + "delimiter": ",", + "quote_columns": null + }, + "tags": [], + "description": "Generated lookup 1.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "GENERATED.analytics.lookup_1", + "root_path": null, + "depends_on": { + "macros": [] + } + } + }, + "sources": { + "source.generated_0.open_events": { + "database": null, + "schema": "", + "name": "open_events", + "resource_type": "source", + "package_name": "generated_0", + "path": "sources/open.yml", + "original_file_path": "sources/open.yml", + "unique_id": "source.generated_0.open_events", + "fqn": [ + "generated_0", + "open_events" + ], + "source_name": "open_events", + "source_description": "", + "loader": "", + "identifier": "open_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Events whose columns are only known to the warehouse.", + "columns": {}, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_0.raw_events_0": { + "database": null, + "schema": "", + "name": "raw_events_0", + "resource_type": "source", + "package_name": "generated_0", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_0.raw_events_0", + "fqn": [ + "generated_0", + "raw_events_0" + ], + "source_name": "raw_events_0", + "source_description": "", + "loader": "", + "identifier": "raw_events_0", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_0.raw_events_1": { + "database": null, + "schema": "", + "name": "raw_events_1", + "resource_type": "source", + "package_name": "generated_0", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_0.raw_events_1", + "fqn": [ + "generated_0", + "raw_events_1" + ], + "source_name": "raw_events_1", + "source_description": "", + "loader": "", + "identifier": "raw_events_1", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 1.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.generated_0.adjust_0": { + "name": "adjust_0", + "resource_type": "macro", + "package_name": "generated_0", + "path": "macros/adjust_0.py", + "original_file_path": "macros/adjust_0.py", + "unique_id": "macro.generated_0.adjust_0", + "macro_sql": "def adjust_0_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_0(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_0_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [ + "macro.generated_0.adjust_0_round" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.adjust_0_round": { + "name": "adjust_0_round", + "resource_type": "macro", + "package_name": "generated_0", + "path": "macros/adjust_0.py", + "original_file_path": "macros/adjust_0.py", + "unique_id": "macro.generated_0.adjust_0_round", + "macro_sql": "def adjust_0_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_0(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_0_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.adjust_2": { + "name": "adjust_2", + "resource_type": "macro", + "package_name": "generated_0", + "path": "macros/adjust_2.py", + "original_file_path": "macros/adjust_2.py", + "unique_id": "macro.generated_0.adjust_2", + "macro_sql": "def adjust_2(ctx, expression: str) -> str:\n \"\"\"Scale an amount by the configured discount.\"\"\"\n rate = ctx.vars[\"discount_rate\"]\n return f\"({expression} * (1 - {rate}))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.analysis_region": { + "name": "analysis_region", + "resource_type": "macro", + "package_name": "generated_0", + "path": "models/analysis/_sqlbuild/_macros/regions.py", + "original_file_path": "models/analysis/_sqlbuild/_macros/regions.py", + "unique_id": "macro.generated_0.analysis_region", + "macro_sql": "def analysis_region() -> str:\n \"\"\"Return the region rows are assigned to.\"\"\"\n return \"'east'\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/analysis" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.adjust_1": { + "name": "adjust_1", + "resource_type": "macro", + "package_name": "generated_0", + "path": "models/fulfillment/staging/_sqlbuild/_macros/adjust_1.py", + "original_file_path": "models/fulfillment/staging/_sqlbuild/_macros/adjust_1.py", + "unique_id": "macro.generated_0.adjust_1", + "macro_sql": "import os\n\n\ndef adjust_1(expression: str) -> str:\n \"\"\"Tag an amount with the deployment region.\"\"\"\n region = os.environ.get(\"SQB_DIFFERENTIAL_REGION\", \"east\")\n return f\"({expression} + LENGTH('{region}'))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/fulfillment/staging" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0__sqlbuild_hooks.record_refresh": { + "name": "record_refresh", + "resource_type": "macro", + "package_name": "generated_0__sqlbuild_hooks", + "path": "hooks/sql/record_refresh.sql", + "original_file_path": "hooks/sql/record_refresh.sql", + "unique_id": "macro.generated_0__sqlbuild_hooks.record_refresh", + "macro_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "depends_on": { + "macros": [] + }, + "description": "Record a refresh for one relation", + "meta": { + "sqlbuild_resource_type": "sql_hook", + "sqlbuild_hook_name": "record_refresh" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.generated_0.banded_amounts": [ + "model.generated_0.table_fn__amount_bands" + ], + "model.generated_0.chain_1_stg_sales_0": [ + "model.generated_0.contracted_stg_sales_0" + ], + "model.generated_0.chain_2_stg_sales_0": [ + "model.generated_0.chain_1_stg_sales_0" + ], + "model.generated_0.chain_3_stg_sales_0": [ + "model.generated_0.chain_2_stg_sales_0" + ], + "model.generated_0.checked_stg_fulfillment_1": [ + "model.generated_0.stg_fulfillment_1" + ], + "model.generated_0.combined_stg_fulfillment_0": [ + "model.generated_0.stg_fulfillment_0", + "model.generated_0.stg_sales_1" + ], + "model.generated_0.contracted_stg_sales_0": [ + "source.generated_0.raw_events_0" + ], + "model.generated_0.every_open_event": [ + "source.generated_0.open_events" + ], + "model.generated_0.every_raw_events_0": [ + "source.generated_0.raw_events_0" + ], + "model.generated_0.every_stg_fulfillment_0": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.passed_stg_fulfillment_0": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.regional_stg_fulfillment_1": [ + "model.generated_0.stg_fulfillment_1" + ], + "model.generated_0.scaled_stg_fulfillment_0": [ + "model.generated_0.scaled_amount", + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.typed_stg_fulfillment_0": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.unanalysed_stg_fulfillment_0": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.fulfillment_summary_0": [ + "model.generated_0.stg_fulfillment_0", + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_1" + ], + "model.generated_0.fulfillment_summary_1": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.fulfillment_summary_2": [ + "model.generated_0.stg_fulfillment_1", + "seed.generated_0.lookup_0" + ], + "model.generated_0.stg_fulfillment_0": [ + "source.generated_0.raw_events_1" + ], + "model.generated_0.stg_fulfillment_1": [ + "source.generated_0.raw_events_0" + ], + "model.generated_0.sales_summary_0": [ + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_1" + ], + "model.generated_0.sales_summary_1": [ + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_0" + ], + "model.generated_0.sales_summary_2": [ + "model.generated_0.stg_sales_1", + "model.generated_0.stg_fulfillment_0", + "seed.generated_0.lookup_1" + ], + "model.generated_0.stg_sales_0": [ + "source.generated_0.raw_events_0" + ], + "model.generated_0.stg_sales_1": [ + "source.generated_0.raw_events_1" + ], + "source.generated_0.open_events": [], + "source.generated_0.raw_events_0": [], + "source.generated_0.raw_events_1": [], + "seed.generated_0.lookup_0": [], + "seed.generated_0.lookup_1": [], + "model.generated_0.scaled_amount": [], + "model.generated_0.table_fn__amount_bands": [ + "model.generated_0.stg_fulfillment_0" + ] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/seed/0.json b/tests/goldens/compiler/seed/0.json new file mode 100644 index 0000000000..28b8246e6b --- /dev/null +++ b/tests/goldens/compiler/seed/0.json @@ -0,0 +1,3479 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-store-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-select", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-no-analysis", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-rich-lineage", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "audits/generic/configured_events/accepted_values__id.sql": [ + "SELECT id", + "FROM __source(\"configured_events\")", + "WHERE id IS NOT NULL", + " AND id NOT IN ('1')", + "" + ], + "audits/generic/configured_stg_sales_1/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"configured_stg_sales_1\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'shipped')", + "" + ], + "audits/generic/configured_stg_sales_1/configured_amount_floor.sql": [ + "SELECT *", + "FROM __ref(\"configured_stg_sales_1\")", + "WHERE amount < -35", + "" + ], + "audits/generic/configured_stg_sales_1/configured_id_present__id.sql": [ + "SELECT id", + "FROM __ref(\"configured_stg_sales_1\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/configured_stg_sales_1/unique__id.sql": [ + "SELECT id, COUNT(*) AS duplicate_count", + "FROM __ref(\"configured_stg_sales_1\")", + "WHERE id IS NOT NULL", + "GROUP BY id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/fulfillment_summary_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"fulfillment_summary_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/labelled_stg_fulfillment_0/tidy_status__status.sql": [ + "SELECT *", + "FROM __ref(\"labelled_stg_fulfillment_0\")", + "WHERE status <> LOWER(TRIM(status))", + "" + ], + "audits/generic/sales_summary_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"sales_summary_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/sales_summary_2/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"sales_summary_2\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/shaped_stg_sales_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"shaped_stg_sales_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_fulfillment_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_fulfillment_0\")", + "WHERE id IS NULL", + "" + ], + "audits/singular/fulfillment_summary_2_matches.sql": [ + "SELECT a.id", + "FROM __ref(\"fulfillment_summary_2\") a", + "LEFT JOIN __ref(\"fulfillment_summary_0\") b ON a.id = b.id", + "WHERE b.id IS NULL", + "" + ], + "audits/singular/labelled_channels_match.sql": [ + "SELECT l.id", + "FROM __ref(\"labelled_stg_fulfillment_0\") l", + "JOIN __ref(\"channel_labels\") c ON l.id = c.id", + "WHERE l.status = c.channel", + "" + ], + "functions/python/is_large.sql": [ + "REGISTER PYTHON FUNCTION is_large(DOUBLE) RETURNS BOOLEAN", + "" + ], + "functions/sql/configured_label.sql": [ + "CREATE OR REPLACE MACRO ci_checks.configured_label(raw_status) AS (", + "UPPER(raw_status)", + ")", + "" + ], + "functions/sql/is_placed.sql": [ + "CREATE OR REPLACE MACRO ci_checks.is_placed(event_status) AS (", + "event_status = 'placed'", + ")", + "" + ], + "functions/sql/table_fn__events_above.sql": [ + "CREATE OR REPLACE MACRO ci_checks.table_fn__events_above(p_minimum) AS TABLE", + "SELECT id, amount", + "FROM __ref(\"stg_sales_1\")", + "WHERE amount > p_minimum", + "" + ], + "functions/sql/tidy_status.sql": [ + "CREATE OR REPLACE MACRO ci_checks.tidy_status(raw_status) AS (", + "LOWER(TRIM(raw_status))", + ")", + "" + ], + "models/analysis/pivot_input_stg_sales_0.sql": [ + "SELECT CAST(id AS INTEGER) AS id, CAST(status AS VARCHAR) AS status, amount", + "FROM __ref(\"stg_sales_0\")", + "" + ], + "models/analysis/pivoted_stg_sales_0.sql": [ + "PIVOT __ref(\"pivot_input_stg_sales_0\")", + "ON status", + "USING MAX(amount)", + "GROUP BY id", + "" + ], + "models/analysis/regional_stg_fulfillment_0.sql": [ + "SELECT id, amount, 'east' AS region", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/analysis/unanalysed_stg_sales_0.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_sales_0\")", + "WHERE id = ANY [1, 2]", + "" + ], + "models/features/append_stg_fulfillment_1.sql": [ + "SELECT id, amount, status, created_at", + "FROM __ref(\"stg_fulfillment_1\")", + "" + ], + "models/features/batched_rolling_window_stg_sales_0.sql": [ + "SELECT CAST(created_at AS DATE) AS created_at, SUM(amount) AS amount", + "FROM __ref(\"stg_sales_0\")", + "GROUP BY CAST(created_at AS DATE)", + "" + ], + "models/features/flagged_stg_fulfillment_0.sql": [ + "SELECT id, __udf(\"is_placed\")(status) AS is_placed,", + " __udf(\"is_large\")(amount) AS is_large", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/features/product_labels.sql": [ + "SELECT id, label", + "FROM __source(\"loaded_products\")", + "" + ], + "models/features/shaped_stg_sales_0.sql": [ + "SELECT CAST(id AS INTEGER) AS id, status", + "FROM __ref(\"stg_sales_0\")", + "" + ], + "models/features/taxed_stg_fulfillment_0.sql": [ + "SELECT id, ROUND(amount * 1.2, 2) AS taxed, ROUND(amount, 1) AS rounded", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/fulfillment/marts/fulfillment_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount * (1 - 0.1)) AS adjust_2_amount,", + " j2.label AS lookup_label_2,", + " 'naïve résumé' AS site_label", + "FROM __ref(\"stg_fulfillment_0\") t", + "LEFT JOIN __ref(\"stg_sales_0\") j1 ON t.id = j1.id", + "LEFT JOIN __seed(\"lookup_1\") j2 ON t.id = j2.id", + "" + ], + "models/fulfillment/marts/fulfillment_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at", + "FROM __ref(\"stg_fulfillment_0\") t", + "" + ], + "models/fulfillment/marts/fulfillment_summary_2.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount * (1 - 0.1)) AS adjust_2_amount,", + " j1.label AS lookup_label_1", + "FROM __ref(\"stg_fulfillment_1\") t", + "LEFT JOIN __seed(\"lookup_0\") j1 ON t.id = j1.id", + "" + ], + "models/fulfillment/staging/stg_fulfillment_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " 'naïve résumé' AS site_label", + "FROM __source(\"raw_events_1\") t", + "" + ], + "models/fulfillment/staging/stg_fulfillment_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'Ελληνικά orders' AS threshold_0_label,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_0_amount,", + " 'naïve résumé' AS site_label", + "FROM __source(\"raw_events_0\") t", + "WHERE t.status <> 'expédié'", + "" + ], + "models/rendering/bounded_stg_fulfillment_1.sql": [ + "SELECT id, amount, created_at", + "FROM __ref(\"stg_fulfillment_1\")", + "WHERE created_at >= __cursor_start()", + " AND created_at < __cursor_end()", + "" + ], + "models/rendering/channel_labels.sql": [ + "SELECT id, channel", + "FROM __source(\"labelled_channels\")", + "" + ], + "models/rendering/configured_stg_sales_1.sql": [ + "SELECT id, amount, status", + "FROM __ref(\"stg_sales_1\")", + "" + ], + "models/rendering/labelled_stg_fulfillment_0.sql": [ + "SELECT id, LOWER(TRIM(status)) AS status,", + " __udf(\"tidy_status\")(status) AS tidied", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/rendering/large_events.sql": [ + "SELECT id, amount", + "FROM __table_fn(\"table_fn__events_above\")(4)", + "" + ], + "models/rendering/latest_raw_events_1.sql": [ + "SELECT id, amount", + "FROM (SELECT id, amount FROM __source(\"raw_events_1\") ORDER BY id DESC LIMIT 2) AS latest", + "" + ], + "models/rendering/unioned_event_ids.sql": [ + "SELECT id", + "FROM (SELECT id FROM __ref(\"stg_sales_0\") UNION ALL SELECT id FROM __ref(\"stg_sales_1\")) AS unioned", + "" + ], + "models/sales/marts/sales_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'Ελληνικά orders' AS threshold_0_label,", + " j1.label AS lookup_label_1", + "FROM __ref(\"stg_sales_0\") t", + "LEFT JOIN __seed(\"lookup_1\") j1 ON t.id = j1.id", + "" + ], + "models/sales/marts/sales_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount * (1 - 0.1)) AS adjust_2_amount,", + " j1.label AS lookup_label_1", + "FROM __ref(\"stg_sales_0\") t", + "LEFT JOIN __seed(\"lookup_0\") j1 ON t.id = j1.id", + "WHERE t.status <> '取消'", + "" + ], + "models/sales/marts/sales_summary_2.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'naïve résumé' AS threshold_1_label,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_0_amount,", + " j2.label AS lookup_label_2", + "FROM __ref(\"stg_sales_1\") t", + "LEFT JOIN __ref(\"stg_fulfillment_0\") j1 ON t.id = j1.id", + "LEFT JOIN __seed(\"lookup_1\") j2 ON t.id = j2.id", + "" + ], + "models/sales/staging/stg_sales_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * '1e-07' AS threshold_2_amount,", + " 'naïve résumé' AS site_label", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/sales/staging/stg_sales_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'naïve résumé' AS threshold_1_label", + "FROM __source(\"raw_events_1\") t", + "" + ], + "tests/_chain_/labelled_stg_fulfillment_0__stg_fulfillment_0/test_labelled_stg_fulfillment_0.sql": [ + "WITH __source__raw_events_1 AS (SELECT 1 AS id, CAST(1 AS DOUBLE) AS amount, 'placed' AS status, TIMESTAMP '2026-01-01 00:00:00' AS created_at UNION ALL SELECT 2 AS id, CAST(2 AS DOUBLE) AS amount, 'placed' AS status, TIMESTAMP '2026-01-02 00:00:00' AS created_at),", + "__ref__stg_fulfillment_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " 'naïve résumé' AS site_label", + "FROM __source__raw_events_1 t),", + "__ref__labelled_stg_fulfillment_0 AS (SELECT id, LOWER(TRIM(status)) AS status,", + " ci_checks.tidy_status(status) AS tidied", + "FROM __ref__stg_fulfillment_0),", + "__actual__labelled_stg_fulfillment_0 AS (SELECT * FROM __ref__labelled_stg_fulfillment_0),", + "__expected__labelled_stg_fulfillment_0 AS (SELECT 1 AS id, LOWER(TRIM('placed')) AS status", + " UNION ALL", + " SELECT 2 AS id, 'placed' AS status)", + "SELECT 1 AS step_index, 'labelled_stg_fulfillment_0' AS model_name, (SELECT COUNT(*) FROM __actual__labelled_stg_fulfillment_0) AS actual_count, (SELECT COUNT(*) FROM __expected__labelled_stg_fulfillment_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __actual__labelled_stg_fulfillment_0 EXCEPT SELECT id, status FROM __expected__labelled_stg_fulfillment_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __expected__labelled_stg_fulfillment_0 EXCEPT SELECT id, status FROM __actual__labelled_stg_fulfillment_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/macro taxes_amounts/taxes_amounts.sql": [ + "WITH input_values AS (SELECT 10 AS amount),", + "__actual__macro_taxes_amounts AS (SELECT ROUND(amount * 1.2, 2) AS taxed", + " FROM input_values),", + "__expected__macro_taxes_amounts AS (SELECT 12.0 AS taxed)", + "SELECT 0 AS step_index, 'macro taxes_amounts' AS model_name, (SELECT COUNT(*) FROM __actual__macro_taxes_amounts) AS actual_count, (SELECT COUNT(*) FROM __expected__macro_taxes_amounts) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__macro_taxes_amounts EXCEPT SELECT * FROM __expected__macro_taxes_amounts) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__macro_taxes_amounts EXCEPT SELECT * FROM __actual__macro_taxes_amounts) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/regional_stg_fulfillment_0/test_regional_stg_fulfillment_0.sql": [ + "WITH __ref__stg_fulfillment_0 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__regional_stg_fulfillment_0 AS (SELECT id, amount, 'west' AS region", + "FROM __ref__stg_fulfillment_0),", + "__actual__regional_stg_fulfillment_0 AS (SELECT * FROM __ref__regional_stg_fulfillment_0),", + "__expected__regional_stg_fulfillment_0 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'west' AS region)", + "SELECT 0 AS step_index, 'regional_stg_fulfillment_0' AS model_name, (SELECT COUNT(*) FROM __actual__regional_stg_fulfillment_0) AS actual_count, (SELECT COUNT(*) FROM __expected__regional_stg_fulfillment_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __actual__regional_stg_fulfillment_0 EXCEPT SELECT id, amount, region FROM __expected__regional_stg_fulfillment_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __expected__regional_stg_fulfillment_0 EXCEPT SELECT id, amount, region FROM __actual__regional_stg_fulfillment_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/stg_fulfillment_1/test_stg_fulfillment_1.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(10 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_fulfillment_1 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'Ελληνικά orders' AS threshold_0_label,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_0_amount,", + " 'naïve résumé' AS site_label", + "FROM __source__raw_events_0 t", + "WHERE t.status <> 'expédié'),", + "__actual__stg_fulfillment_1 AS (SELECT * FROM __ref__stg_fulfillment_1),", + "__expected__stg_fulfillment_1 AS (SELECT 1 AS id, 'placed' AS status)", + "SELECT 0 AS step_index, 'stg_fulfillment_1' AS model_name, (SELECT COUNT(*) FROM __actual__stg_fulfillment_1) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_fulfillment_1) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __actual__stg_fulfillment_1 EXCEPT SELECT id, status FROM __expected__stg_fulfillment_1) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __expected__stg_fulfillment_1 EXCEPT SELECT id, status FROM __actual__stg_fulfillment_1) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/tests/unit/test_stg_sales_1_cases/block_1__labelled.sql": [ + "WITH __source__raw_events_1 AS (SELECT 1 AS id, CAST(2.25 AS DOUBLE) AS amount,", + " '東京 warehouse' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_sales_1 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'naïve résumé' AS threshold_1_label", + "FROM __source__raw_events_1 t),", + "__actual__stg_sales_1 AS (SELECT * FROM __ref__stg_sales_1),", + "__expected__stg_sales_1 AS (SELECT 1 AS id)", + "SELECT 0 AS step_index, 'stg_sales_1' AS model_name, (SELECT COUNT(*) FROM __actual__stg_sales_1) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_sales_1) AS expected_count, (SELECT COUNT(*) FROM (SELECT id FROM __actual__stg_sales_1 EXCEPT SELECT id FROM __expected__stg_sales_1) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id FROM __expected__stg_sales_1 EXCEPT SELECT id FROM __actual__stg_sales_1) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/tests/unit/test_stg_sales_1_cases/block_1__placed.sql": [ + "WITH __source__raw_events_1 AS (SELECT 1 AS id, CAST(1.5 AS DOUBLE) AS amount,", + " 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_sales_1 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'naïve résumé' AS threshold_1_label", + "FROM __source__raw_events_1 t),", + "__actual__stg_sales_1 AS (SELECT * FROM __ref__stg_sales_1),", + "__expected__stg_sales_1 AS (SELECT 1 AS id)", + "SELECT 0 AS step_index, 'stg_sales_1' AS model_name, (SELECT COUNT(*) FROM __actual__stg_sales_1) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_sales_1) AS expected_count, (SELECT COUNT(*) FROM (SELECT id FROM __actual__stg_sales_1 EXCEPT SELECT id FROM __expected__stg_sales_1) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id FROM __expected__stg_sales_1 EXCEPT SELECT id FROM __actual__stg_sales_1) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/udf detects_placed_events/detects_placed_events.sql": [ + "WITH input_values AS (SELECT 'placed' AS event_status),", + "__actual__udf_detects_placed_events AS (SELECT event_status, ci_checks.is_placed(event_status) AS is_placed", + " FROM input_values),", + "__expected__udf_detects_placed_events AS (SELECT 'placed' AS event_status, TRUE AS is_placed)", + "SELECT 0 AS step_index, 'udf detects_placed_events' AS model_name, (SELECT COUNT(*) FROM __actual__udf_detects_placed_events) AS actual_count, (SELECT COUNT(*) FROM __expected__udf_detects_placed_events) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__udf_detects_placed_events EXCEPT SELECT * FROM __expected__udf_detects_placed_events) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__udf_detects_placed_events EXCEPT SELECT * FROM __actual__udf_detects_placed_events) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.generated_0.pivot_input_stg_sales_0": { + "database": null, + "schema": "ci_checks", + "name": "pivot_input_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/pivot_input_stg_sales_0.sql", + "original_file_path": "models/analysis/pivot_input_stg_sales_0.sql", + "unique_id": "model.generated_0.pivot_input_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "pivot_input_stg_sales_0" + ], + "alias": "pivot_input_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Contracted pivot input from stg_sales_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.pivot_input_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_0" + ] + } + }, + "model.generated_0.pivoted_stg_sales_0": { + "database": null, + "schema": "ci_checks", + "name": "pivoted_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/pivoted_stg_sales_0.sql", + "original_file_path": "models/analysis/pivoted_stg_sales_0.sql", + "unique_id": "model.generated_0.pivoted_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "pivoted_stg_sales_0" + ], + "alias": "pivoted_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Amounts of stg_sales_0 pivoted by status", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "dynamic_columns": [ + { + "name": "status_amounts", + "pivot_column": "status", + "value_column": "amount", + "aggregate": "MAX", + "type": "DOUBLE", + "name_pattern": null + } + ] + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.pivoted_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.pivot_input_stg_sales_0" + ] + } + }, + "model.generated_0.regional_stg_fulfillment_0": { + "database": null, + "schema": "ci_checks", + "name": "regional_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/regional_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/regional_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.regional_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "regional_stg_fulfillment_0" + ], + "alias": "regional_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Regional copy of stg_fulfillment_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.regional_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.unanalysed_stg_sales_0": { + "database": null, + "schema": "ci_checks", + "name": "unanalysed_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/analysis/unanalysed_stg_sales_0.sql", + "original_file_path": "models/analysis/unanalysed_stg_sales_0.sql", + "unique_id": "model.generated_0.unanalysed_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "analysis", + "unanalysed_stg_sales_0" + ], + "alias": "unanalysed_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Copy of stg_sales_0 that SQL analysis cannot parse", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.unanalysed_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_0" + ] + } + }, + "model.generated_0.append_stg_fulfillment_1": { + "database": null, + "schema": "ci_checks", + "name": "append_stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/features/append_stg_fulfillment_1.sql", + "original_file_path": "models/features/append_stg_fulfillment_1.sql", + "unique_id": "model.generated_0.append_stg_fulfillment_1", + "fqn": [ + "generated_0", + "models", + "features", + "append_stg_fulfillment_1" + ], + "alias": "append_stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "append", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Incremental append copy of stg_fulfillment_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.append_stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_1" + ] + } + }, + "model.generated_0.batched_rolling_window_stg_sales_0": { + "database": null, + "schema": "ci_checks", + "name": "batched_rolling_window_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/features/batched_rolling_window_stg_sales_0.sql", + "original_file_path": "models/features/batched_rolling_window_stg_sales_0.sql", + "unique_id": "model.generated_0.batched_rolling_window_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "features", + "batched_rolling_window_stg_sales_0" + ], + "alias": "batched_rolling_window_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Microbatched rolling_window totals of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.batched_rolling_window_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_0" + ] + } + }, + "model.generated_0.flagged_stg_fulfillment_0": { + "database": null, + "schema": "ci_checks", + "name": "flagged_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/features/flagged_stg_fulfillment_0.sql", + "original_file_path": "models/features/flagged_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.flagged_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "features", + "flagged_stg_fulfillment_0" + ], + "alias": "flagged_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Function-flagged copy of stg_fulfillment_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.flagged_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.is_placed", + "model.generated_0.is_large", + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.product_labels": { + "database": null, + "schema": "ci_checks", + "name": "product_labels", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/features/product_labels.sql", + "original_file_path": "models/features/product_labels.sql", + "unique_id": "model.generated_0.product_labels", + "fqn": [ + "generated_0", + "models", + "features", + "product_labels" + ], + "alias": "product_labels", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Product labels from the loader", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.product_labels", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.loaded_products" + ] + } + }, + "model.generated_0.shaped_stg_sales_0": { + "database": null, + "schema": "ci_checks", + "name": "shaped_stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/features/shaped_stg_sales_0.sql", + "original_file_path": "models/features/shaped_stg_sales_0.sql", + "unique_id": "model.generated_0.shaped_stg_sales_0", + "fqn": [ + "generated_0", + "models", + "features", + "shaped_stg_sales_0" + ], + "alias": "shaped_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Schema-shaped copy of stg_sales_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.shaped_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_0" + ] + } + }, + "model.generated_0.taxed_stg_fulfillment_0": { + "database": null, + "schema": "ci_checks", + "name": "taxed_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/features/taxed_stg_fulfillment_0.sql", + "original_file_path": "models/features/taxed_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.taxed_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "features", + "taxed_stg_fulfillment_0" + ], + "alias": "taxed_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Taxed copy of stg_fulfillment_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.taxed_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.fulfillment_summary_0": { + "database": null, + "schema": "ci_checks", + "name": "fulfillment_summary_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/marts/fulfillment_summary_0.sql", + "original_file_path": "models/fulfillment/marts/fulfillment_summary_0.sql", + "unique_id": "model.generated_0.fulfillment_summary_0", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "marts", + "fulfillment_summary_0" + ], + "alias": "fulfillment_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of fulfillment activity 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.fulfillment_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0", + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_1" + ] + } + }, + "model.generated_0.fulfillment_summary_1": { + "database": null, + "schema": "ci_checks", + "name": "fulfillment_summary_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/marts/fulfillment_summary_1.sql", + "original_file_path": "models/fulfillment/marts/fulfillment_summary_1.sql", + "unique_id": "model.generated_0.fulfillment_summary_1", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "marts", + "fulfillment_summary_1" + ], + "alias": "fulfillment_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of fulfillment activity 1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.fulfillment_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.fulfillment_summary_2": { + "database": null, + "schema": "ci_checks", + "name": "fulfillment_summary_2", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/marts/fulfillment_summary_2.sql", + "original_file_path": "models/fulfillment/marts/fulfillment_summary_2.sql", + "unique_id": "model.generated_0.fulfillment_summary_2", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "marts", + "fulfillment_summary_2" + ], + "alias": "fulfillment_summary_2", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'ci_checks.fulfillment_summary_2' AS refreshed_relation, 'Zürich – depot' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'ci_checks.fulfillment_summary_2' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of fulfillment activity 2 (naïve résumé)", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'ci_checks.fulfillment_summary_2' AS refreshed_relation, 'Zürich – depot' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "Zürich – depot" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'ci_checks.fulfillment_summary_2' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.fulfillment_summary_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_1", + "seed.generated_0.lookup_0" + ] + } + }, + "model.generated_0.stg_fulfillment_0": { + "database": null, + "schema": "ci_checks", + "name": "stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/staging/stg_fulfillment_0.sql", + "original_file_path": "models/fulfillment/staging/stg_fulfillment_0.sql", + "unique_id": "model.generated_0.stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "staging", + "stg_fulfillment_0" + ], + "alias": "stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged fulfillment events 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_1" + ] + } + }, + "model.generated_0.stg_fulfillment_1": { + "database": null, + "schema": "ci_checks", + "name": "stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/fulfillment/staging/stg_fulfillment_1.sql", + "original_file_path": "models/fulfillment/staging/stg_fulfillment_1.sql", + "unique_id": "model.generated_0.stg_fulfillment_1", + "fqn": [ + "generated_0", + "models", + "fulfillment", + "staging", + "stg_fulfillment_1" + ], + "alias": "stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged fulfillment events 1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_0" + ] + } + }, + "model.generated_0.bounded_stg_fulfillment_1": { + "database": null, + "schema": "ci_checks", + "name": "bounded_stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/rendering/bounded_stg_fulfillment_1.sql", + "original_file_path": "models/rendering/bounded_stg_fulfillment_1.sql", + "unique_id": "model.generated_0.bounded_stg_fulfillment_1", + "fqn": [ + "generated_0", + "models", + "rendering", + "bounded_stg_fulfillment_1" + ], + "alias": "bounded_stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Cursor-bounded copy of stg_fulfillment_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.bounded_stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_fulfillment_1" + ] + } + }, + "model.generated_0.channel_labels": { + "database": null, + "schema": "ci_checks", + "name": "channel_labels", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/rendering/channel_labels.sql", + "original_file_path": "models/rendering/channel_labels.sql", + "unique_id": "model.generated_0.channel_labels", + "fqn": [ + "generated_0", + "models", + "rendering", + "channel_labels" + ], + "alias": "channel_labels", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Normalised channel labels", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.channel_labels", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.labelled_channels" + ] + } + }, + "model.generated_0.configured_stg_sales_1": { + "database": null, + "schema": "ci_checks", + "name": "configured_stg_sales_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/rendering/configured_stg_sales_1.sql", + "original_file_path": "models/rendering/configured_stg_sales_1.sql", + "unique_id": "model.generated_0.configured_stg_sales_1", + "fqn": [ + "generated_0", + "models", + "rendering", + "configured_stg_sales_1" + ], + "alias": "configured_stg_sales_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "release" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "release" + ], + "description": "Configured copy of stg_sales_1 (réglé)", + "columns": { + "id": { + "name": "id", + "description": "Row key", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "Montant réglé", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.configured_stg_sales_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_1" + ] + } + }, + "model.generated_0.labelled_stg_fulfillment_0": { + "database": null, + "schema": "ci_checks", + "name": "labelled_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/rendering/labelled_stg_fulfillment_0.sql", + "original_file_path": "models/rendering/labelled_stg_fulfillment_0.sql", + "unique_id": "model.generated_0.labelled_stg_fulfillment_0", + "fqn": [ + "generated_0", + "models", + "rendering", + "labelled_stg_fulfillment_0" + ], + "alias": "labelled_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Labelled copy of stg_fulfillment_0", + "columns": { + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.labelled_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.tidy_status", + "model.generated_0.stg_fulfillment_0" + ] + } + }, + "model.generated_0.large_events": { + "database": null, + "schema": "ci_checks", + "name": "large_events", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/rendering/large_events.sql", + "original_file_path": "models/rendering/large_events.sql", + "unique_id": "model.generated_0.large_events", + "fqn": [ + "generated_0", + "models", + "rendering", + "large_events" + ], + "alias": "large_events", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Events above a threshold from a table function", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.large_events", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.table_fn__events_above" + ] + } + }, + "model.generated_0.latest_raw_events_1": { + "database": null, + "schema": "ci_checks", + "name": "latest_raw_events_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/rendering/latest_raw_events_1.sql", + "original_file_path": "models/rendering/latest_raw_events_1.sql", + "unique_id": "model.generated_0.latest_raw_events_1", + "fqn": [ + "generated_0", + "models", + "rendering", + "latest_raw_events_1" + ], + "alias": "latest_raw_events_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Newest rows of raw_events_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.latest_raw_events_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_1" + ] + } + }, + "model.generated_0.unioned_event_ids": { + "database": null, + "schema": "ci_checks", + "name": "unioned_event_ids", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/rendering/unioned_event_ids.sql", + "original_file_path": "models/rendering/unioned_event_ids.sql", + "unique_id": "model.generated_0.unioned_event_ids", + "fqn": [ + "generated_0", + "models", + "rendering", + "unioned_event_ids" + ], + "alias": "unioned_event_ids", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Ids from two staged relations", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.unioned_event_ids", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_0", + "model.generated_0.stg_sales_1" + ] + } + }, + "model.generated_0.sales_summary_0": { + "database": null, + "schema": "ci_checks", + "name": "sales_summary_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/marts/sales_summary_0.sql", + "original_file_path": "models/sales/marts/sales_summary_0.sql", + "unique_id": "model.generated_0.sales_summary_0", + "fqn": [ + "generated_0", + "models", + "sales", + "marts", + "sales_summary_0" + ], + "alias": "sales_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "sales", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'ci_checks.sales_summary_0' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'ci_checks.sales_summary_0' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "sales", + "marts" + ], + "description": "Summary of sales activity 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'ci_checks.sales_summary_0' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "Ελληνικά orders" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'ci_checks.sales_summary_0' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.sales_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_1" + ] + } + }, + "model.generated_0.sales_summary_1": { + "database": null, + "schema": "ci_checks", + "name": "sales_summary_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/marts/sales_summary_1.sql", + "original_file_path": "models/sales/marts/sales_summary_1.sql", + "unique_id": "model.generated_0.sales_summary_1", + "fqn": [ + "generated_0", + "models", + "sales", + "marts", + "sales_summary_1" + ], + "alias": "sales_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "sales", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "sales", + "marts" + ], + "description": "Summary of sales activity 1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.sales_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_0" + ] + } + }, + "model.generated_0.sales_summary_2": { + "database": null, + "schema": "ci_checks", + "name": "sales_summary_2", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/marts/sales_summary_2.sql", + "original_file_path": "models/sales/marts/sales_summary_2.sql", + "unique_id": "model.generated_0.sales_summary_2", + "fqn": [ + "generated_0", + "models", + "sales", + "marts", + "sales_summary_2" + ], + "alias": "sales_summary_2", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "sales", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "sales", + "marts" + ], + "description": "Summary of sales activity 2 (Ελληνικά orders)", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.sales_summary_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_0.stg_sales_1", + "model.generated_0.stg_fulfillment_0", + "seed.generated_0.lookup_1" + ] + } + }, + "model.generated_0.stg_sales_0": { + "database": null, + "schema": "ci_checks", + "name": "stg_sales_0", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/staging/stg_sales_0.sql", + "original_file_path": "models/sales/staging/stg_sales_0.sql", + "unique_id": "model.generated_0.stg_sales_0", + "fqn": [ + "generated_0", + "models", + "sales", + "staging", + "stg_sales_0" + ], + "alias": "stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged sales events 0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_0" + ] + } + }, + "model.generated_0.stg_sales_1": { + "database": null, + "schema": "ci_checks", + "name": "stg_sales_1", + "resource_type": "model", + "package_name": "generated_0", + "path": "models/sales/staging/stg_sales_1.sql", + "original_file_path": "models/sales/staging/stg_sales_1.sql", + "unique_id": "model.generated_0.stg_sales_1", + "fqn": [ + "generated_0", + "models", + "sales", + "staging", + "stg_sales_1" + ], + "alias": "stg_sales_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged sales events 1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.stg_sales_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_0.raw_events_1" + ] + } + }, + "seed.generated_0.lookup_0": { + "database": null, + "schema": "ci_checks", + "name": "lookup_0", + "resource_type": "seed", + "package_name": "generated_0", + "path": "seeds/lookup_0.csv", + "original_file_path": "seeds/lookup_0.csv", + "unique_id": "seed.generated_0.lookup_0", + "fqn": [ + "generated_0", + "seeds", + "lookup_0" + ], + "alias": "lookup_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "seed", + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + }, + "delimiter": ",", + "quote_columns": null + }, + "tags": [], + "description": "Generated lookup 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.lookup_0", + "root_path": null, + "depends_on": { + "macros": [] + } + }, + "seed.generated_0.lookup_1": { + "database": null, + "schema": "ci_checks", + "name": "lookup_1", + "resource_type": "seed", + "package_name": "generated_0", + "path": "seeds/lookup_1.csv", + "original_file_path": "seeds/lookup_1.csv", + "unique_id": "seed.generated_0.lookup_1", + "fqn": [ + "generated_0", + "seeds", + "lookup_1" + ], + "alias": "lookup_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "seed", + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + }, + "delimiter": ",", + "quote_columns": null + }, + "tags": [], + "description": "Generated lookup 1.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.lookup_1", + "root_path": null, + "depends_on": { + "macros": [] + } + } + }, + "sources": { + "source.generated_0.configured_events": { + "database": null, + "schema": "", + "name": "configured_events", + "resource_type": "source", + "package_name": "generated_0", + "path": "sources/configured.yml", + "original_file_path": "sources/configured.yml", + "unique_id": "source.generated_0.configured_events", + "fqn": [ + "generated_0", + "configured_events" + ], + "source_name": "configured_events", + "source_description": "", + "loader": "", + "identifier": "configured_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Configured feed events", + "columns": { + "id": { + "name": "id", + "description": "Key id", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "owner": "orders team" + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_0.labelled_channels": { + "database": null, + "schema": "", + "name": "labelled_channels", + "resource_type": "source", + "package_name": "generated_0", + "path": "sources/labelled.yml", + "original_file_path": "sources/labelled.yml", + "unique_id": "source.generated_0.labelled_channels", + "fqn": [ + "generated_0", + "labelled_channels" + ], + "source_name": "labelled_channels", + "source_description": "", + "loader": "", + "identifier": "labelled_channels", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Channel labels normalised in the source expression.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "channel": { + "name": "channel", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_0.loaded_products": { + "database": null, + "schema": "ci_checks", + "name": "loaded_products", + "resource_type": "source", + "package_name": "generated_0", + "path": "sources/managed.yml", + "original_file_path": "sources/managed.yml", + "unique_id": "source.generated_0.loaded_products", + "fqn": [ + "generated_0", + "loaded_products" + ], + "source_name": "loaded_products", + "source_description": "", + "loader": "", + "identifier": "loaded_products", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Products loaded by a project loader.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "loaded_products", + "auto_load": false, + "write_strategy": "table" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_0.raw_events_0": { + "database": null, + "schema": "", + "name": "raw_events_0", + "resource_type": "source", + "package_name": "generated_0", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_0.raw_events_0", + "fqn": [ + "generated_0", + "raw_events_0" + ], + "source_name": "raw_events_0", + "source_description": "", + "loader": "", + "identifier": "raw_events_0", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_0.raw_events_1": { + "database": null, + "schema": "", + "name": "raw_events_1", + "resource_type": "source", + "package_name": "generated_0", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_0.raw_events_1", + "fqn": [ + "generated_0", + "raw_events_1" + ], + "source_name": "raw_events_1", + "source_description": "", + "loader": "", + "identifier": "raw_events_1", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 1.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.generated_0.adjust_0": { + "name": "adjust_0", + "resource_type": "macro", + "package_name": "generated_0", + "path": "macros/adjust_0.py", + "original_file_path": "macros/adjust_0.py", + "unique_id": "macro.generated_0.adjust_0", + "macro_sql": "def adjust_0_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_0(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_0_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [ + "macro.generated_0.adjust_0_round" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.adjust_0_round": { + "name": "adjust_0_round", + "resource_type": "macro", + "package_name": "generated_0", + "path": "macros/adjust_0.py", + "original_file_path": "macros/adjust_0.py", + "unique_id": "macro.generated_0.adjust_0_round", + "macro_sql": "def adjust_0_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_0(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_0_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.adjust_2": { + "name": "adjust_2", + "resource_type": "macro", + "package_name": "generated_0", + "path": "macros/adjust_2.py", + "original_file_path": "macros/adjust_2.py", + "unique_id": "macro.generated_0.adjust_2", + "macro_sql": "def adjust_2(ctx, expression: str) -> str:\n \"\"\"Scale an amount by the configured discount.\"\"\"\n rate = ctx.vars[\"discount_rate\"]\n return f\"({expression} * (1 - {rate}))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.tidy_label": { + "name": "tidy_label", + "resource_type": "macro", + "package_name": "generated_0", + "path": "macros/labels.py", + "original_file_path": "macros/labels.py", + "unique_id": "macro.generated_0.tidy_label", + "macro_sql": "def tidy_label(expression: str) -> str:\n \"\"\"Trim and lower-case a label.\"\"\"\n return f\"LOWER(TRIM({expression}))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.round_amount": { + "name": "round_amount", + "resource_type": "macro", + "package_name": "generated_0", + "path": "macros/rounding.py", + "original_file_path": "macros/rounding.py", + "unique_id": "macro.generated_0.round_amount", + "macro_sql": "def round_amount(expression: str, places: int = 2) -> str:\n \"\"\"Round an amount.\"\"\"\n return f\"ROUND({expression}, {places})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.taxed": { + "name": "taxed", + "resource_type": "macro", + "package_name": "generated_0", + "path": "macros/tax.py", + "original_file_path": "macros/tax.py", + "unique_id": "macro.generated_0.taxed", + "macro_sql": "from macros.rounding import round_amount\n\n\ndef taxed(expression: str) -> str:\n \"\"\"Add tax to an amount, rounded.\"\"\"\n return round_amount(f\"{expression} * 1.2\")\n", + "depends_on": { + "macros": [ + "macro.generated_0.round_amount" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.analysis_region": { + "name": "analysis_region", + "resource_type": "macro", + "package_name": "generated_0", + "path": "models/analysis/_sqlbuild/_macros/regions.py", + "original_file_path": "models/analysis/_sqlbuild/_macros/regions.py", + "unique_id": "macro.generated_0.analysis_region", + "macro_sql": "def analysis_region() -> str:\n \"\"\"Return the region rows are assigned to.\"\"\"\n return \"'east'\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/analysis" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.adjust_1": { + "name": "adjust_1", + "resource_type": "macro", + "package_name": "generated_0", + "path": "models/fulfillment/staging/_sqlbuild/_macros/adjust_1.py", + "original_file_path": "models/fulfillment/staging/_sqlbuild/_macros/adjust_1.py", + "unique_id": "macro.generated_0.adjust_1", + "macro_sql": "import os\n\n\ndef adjust_1(expression: str) -> str:\n \"\"\"Tag an amount with the deployment region.\"\"\"\n region = os.environ.get(\"SQB_DIFFERENTIAL_REGION\", \"east\")\n return f\"({expression} + LENGTH('{region}'))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/fulfillment/staging" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.latest_rows": { + "name": "latest_rows", + "resource_type": "macro", + "package_name": "generated_0", + "path": "models/rendering/_sqlbuild/_macros/relations.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/relations.py", + "unique_id": "macro.generated_0.latest_rows", + "macro_sql": "from sqlbuild.refs import SqlResourceRef\n\n\ndef union_ids(relations: list[SqlResourceRef]) -> str:\n \"\"\"Union the ids of several relations.\"\"\"\n selects = [f\"SELECT id FROM {relation}\" for relation in relations]\n return \" UNION ALL \".join(selects)\n\n\ndef latest_rows(relation: SqlResourceRef, limit: int = 2) -> str:\n \"\"\"Return the newest rows of one relation.\"\"\"\n return f\"(SELECT id, amount FROM {relation} ORDER BY id DESC LIMIT {limit})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.union_ids": { + "name": "union_ids", + "resource_type": "macro", + "package_name": "generated_0", + "path": "models/rendering/_sqlbuild/_macros/relations.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/relations.py", + "unique_id": "macro.generated_0.union_ids", + "macro_sql": "from sqlbuild.refs import SqlResourceRef\n\n\ndef union_ids(relations: list[SqlResourceRef]) -> str:\n \"\"\"Union the ids of several relations.\"\"\"\n selects = [f\"SELECT id FROM {relation}\" for relation in relations]\n return \" UNION ALL \".join(selects)\n\n\ndef latest_rows(relation: SqlResourceRef, limit: int = 2) -> str:\n \"\"\"Return the newest rows of one relation.\"\"\"\n return f\"(SELECT id, amount FROM {relation} ORDER BY id DESC LIMIT {limit})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0.event_rows": { + "name": "event_rows", + "resource_type": "macro", + "package_name": "generated_0", + "path": "tests/unit/rendering/_sqlbuild/_macros/fixtures.py", + "original_file_path": "tests/unit/rendering/_sqlbuild/_macros/fixtures.py", + "unique_id": "macro.generated_0.event_rows", + "macro_sql": "def event_rows(count: int = 2) -> str:\n \"\"\"Return fixture event rows.\"\"\"\n return \" UNION ALL \".join(\n f\"SELECT {index} AS id, CAST({index} AS DOUBLE) AS amount, \"\n f\"'placed' AS status, \"\n f\"TIMESTAMP '2026-01-0{index} 00:00:00' AS created_at\"\n for index in range(1, count + 1)\n )\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "tests/unit/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_0__sqlbuild_hooks.record_refresh": { + "name": "record_refresh", + "resource_type": "macro", + "package_name": "generated_0__sqlbuild_hooks", + "path": "hooks/sql/record_refresh.sql", + "original_file_path": "hooks/sql/record_refresh.sql", + "unique_id": "macro.generated_0__sqlbuild_hooks.record_refresh", + "macro_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "depends_on": { + "macros": [] + }, + "description": "Record a refresh for one relation", + "meta": { + "sqlbuild_resource_type": "sql_hook", + "sqlbuild_hook_name": "record_refresh" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.generated_0.pivot_input_stg_sales_0": [ + "model.generated_0.stg_sales_0" + ], + "model.generated_0.pivoted_stg_sales_0": [ + "model.generated_0.pivot_input_stg_sales_0" + ], + "model.generated_0.regional_stg_fulfillment_0": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.unanalysed_stg_sales_0": [ + "model.generated_0.stg_sales_0" + ], + "model.generated_0.append_stg_fulfillment_1": [ + "model.generated_0.stg_fulfillment_1" + ], + "model.generated_0.batched_rolling_window_stg_sales_0": [ + "model.generated_0.stg_sales_0" + ], + "model.generated_0.flagged_stg_fulfillment_0": [ + "model.generated_0.is_placed", + "model.generated_0.is_large", + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.product_labels": [ + "source.generated_0.loaded_products" + ], + "model.generated_0.shaped_stg_sales_0": [ + "model.generated_0.stg_sales_0" + ], + "model.generated_0.taxed_stg_fulfillment_0": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.fulfillment_summary_0": [ + "model.generated_0.stg_fulfillment_0", + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_1" + ], + "model.generated_0.fulfillment_summary_1": [ + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.fulfillment_summary_2": [ + "model.generated_0.stg_fulfillment_1", + "seed.generated_0.lookup_0" + ], + "model.generated_0.stg_fulfillment_0": [ + "source.generated_0.raw_events_1" + ], + "model.generated_0.stg_fulfillment_1": [ + "source.generated_0.raw_events_0" + ], + "model.generated_0.bounded_stg_fulfillment_1": [ + "model.generated_0.stg_fulfillment_1" + ], + "model.generated_0.channel_labels": [ + "source.generated_0.labelled_channels" + ], + "model.generated_0.configured_stg_sales_1": [ + "model.generated_0.stg_sales_1" + ], + "model.generated_0.labelled_stg_fulfillment_0": [ + "model.generated_0.tidy_status", + "model.generated_0.stg_fulfillment_0" + ], + "model.generated_0.large_events": [ + "model.generated_0.table_fn__events_above" + ], + "model.generated_0.latest_raw_events_1": [ + "source.generated_0.raw_events_1" + ], + "model.generated_0.unioned_event_ids": [ + "model.generated_0.stg_sales_0", + "model.generated_0.stg_sales_1" + ], + "model.generated_0.sales_summary_0": [ + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_1" + ], + "model.generated_0.sales_summary_1": [ + "model.generated_0.stg_sales_0", + "seed.generated_0.lookup_0" + ], + "model.generated_0.sales_summary_2": [ + "model.generated_0.stg_sales_1", + "model.generated_0.stg_fulfillment_0", + "seed.generated_0.lookup_1" + ], + "model.generated_0.stg_sales_0": [ + "source.generated_0.raw_events_0" + ], + "model.generated_0.stg_sales_1": [ + "source.generated_0.raw_events_1" + ], + "source.generated_0.configured_events": [], + "source.generated_0.labelled_channels": [], + "source.generated_0.loaded_products": [], + "source.generated_0.raw_events_0": [], + "source.generated_0.raw_events_1": [], + "seed.generated_0.lookup_0": [], + "seed.generated_0.lookup_1": [], + "model.generated_0.configured_label": [], + "model.generated_0.is_placed": [], + "model.generated_0.table_fn__events_above": [ + "model.generated_0.stg_sales_1" + ], + "model.generated_0.tidy_status": [], + "model.generated_0.is_large": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/seed/1.json b/tests/goldens/compiler/seed/1.json new file mode 100644 index 0000000000..49b3078359 --- /dev/null +++ b/tests/goldens/compiler/seed/1.json @@ -0,0 +1,37 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "C214", + "message": "Model file models/features/dbt_order_counts.sql uses __dbt_ref(\"upstream_orders\") but no dbt manifest was found", + "help": "Run dbt compile or configure dbt target_path so SQLBuild can read manifest.json." + } + ] + }, + { + "label": "compile-store-warm", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "C214", + "message": "Model file models/features/dbt_order_counts.sql uses __dbt_ref(\"upstream_orders\") but no dbt manifest was found", + "help": "Run dbt compile or configure dbt target_path so SQLBuild can read manifest.json." + } + ] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/seed/10.json b/tests/goldens/compiler/seed/10.json new file mode 100644 index 0000000000..e5d7177d6c --- /dev/null +++ b/tests/goldens/compiler/seed/10.json @@ -0,0 +1,3302 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-store-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-select", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-no-analysis", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-rich-lineage", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "audits/generic/audited_stg_fulfillment_1/id_present__id.sql": [ + "SELECT id", + "FROM __ref(\"audited_stg_fulfillment_1\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/checked_stg_fulfillment_0/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"checked_stg_fulfillment_0\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'expédié', '取消', 'returned ✓')", + "" + ], + "audits/generic/checked_stg_fulfillment_0/expression_is_true.sql": [ + "SELECT *", + "FROM __ref(\"checked_stg_fulfillment_0\")", + "WHERE NOT (amount >= -1000)", + "" + ], + "audits/generic/checked_stg_fulfillment_0/relationships__id.sql": [ + "SELECT id", + "FROM __ref(\"checked_stg_fulfillment_0\")", + "WHERE id IS NOT NULL", + " AND id NOT IN (", + " SELECT id", + " FROM __ref(\"stg_fulfillment_0\")", + " WHERE id IS NOT NULL", + " )", + "" + ], + "audits/generic/fulfillment_summary_1/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"fulfillment_summary_1\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/guarded_stg_inventory_1/amount_at_least__amount.sql": [ + "SELECT *", + "FROM __ref(\"guarded_stg_inventory_1\")", + "WHERE amount < 0", + "" + ], + "audits/generic/stated_stg_fulfillment_1/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"stated_stg_fulfillment_1\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'expédié', '取消', 'returned ✓')", + "" + ], + "audits/generic/stg_fulfillment_1/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_fulfillment_1\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_inventory_1/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_inventory_1\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_sales_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_sales_0\")", + "WHERE id IS NULL", + "" + ], + "audits/singular/fulfillment_summary_1_matches.sql": [ + "SELECT a.id", + "FROM __ref(\"fulfillment_summary_1\") a", + "LEFT JOIN __ref(\"fulfillment_summary_0\") b ON a.id = b.id", + "WHERE b.id IS NULL", + "" + ], + "functions/python/is_large.sql": [ + "REGISTER PYTHON FUNCTION is_large(DOUBLE) RETURNS BOOLEAN", + "" + ], + "functions/sql/is_placed.sql": [ + "CREATE OR REPLACE MACRO main.is_placed(event_status) AS (", + "event_status = 'placed'", + ")", + "" + ], + "functions/sql/table_fn__events_above.sql": [ + "CREATE OR REPLACE MACRO main.table_fn__events_above(p_minimum) AS TABLE", + "SELECT id, amount", + "FROM __ref(\"stg_inventory_0\")", + "WHERE amount > p_minimum", + "" + ], + "models/analysis/chain_1_stg_sales_0.sql": [ + "SELECT id, label, amount", + "FROM __ref(\"contracted_stg_sales_0\")", + "" + ], + "models/analysis/chain_2_stg_sales_0.sql": [ + "SELECT id, UPPER(label) AS label, amount", + "FROM __ref(\"chain_1_stg_sales_0\")", + "" + ], + "models/analysis/chain_3_stg_sales_0.sql": [ + "SELECT id, label, amount", + "FROM __ref(\"chain_2_stg_sales_0\")", + "" + ], + "models/analysis/checked_stg_fulfillment_0.sql": [ + "SELECT id, amount, status", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/analysis/contracted_stg_sales_0.sql": [ + "SELECT CAST(id AS INTEGER) AS id, CAST(status AS VARCHAR(34)) AS label,", + " amount", + "FROM __source(\"raw_events_1\")", + "" + ], + "models/analysis/regional_stg_inventory_0.sql": [ + "SELECT id, amount, 'north' AS region", + "FROM __ref(\"stg_inventory_0\")", + "" + ], + "models/features/audited_stg_fulfillment_1.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_fulfillment_1\")", + "" + ], + "models/features/check_history_stg_fulfillment_1.sql": [ + "SELECT id, status, amount", + "FROM __ref(\"stg_fulfillment_1\")", + "" + ], + "models/features/copied_stg_sales_0.sql": [ + "SELECT id, status", + "FROM __ref(\"stg_sales_0\")", + "" + ], + "models/features/flagged_stg_inventory_1.sql": [ + "SELECT id, __udf(\"is_placed\")(status) AS is_placed,", + " __udf(\"is_large\")(amount) AS is_large", + "FROM __ref(\"stg_inventory_1\")", + "" + ], + "models/features/guarded_stg_inventory_1.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_inventory_1\")", + "" + ], + "models/features/merge_stg_sales_0.sql": [ + "SELECT id, amount, status, created_at", + "FROM __ref(\"stg_sales_0\")", + "" + ], + "models/features/product_labels.sql": [ + "SELECT id, label", + "FROM __source(\"loaded_products\")", + "" + ], + "models/features/spaced_stg_sales_0.sql": [ + "-- Généré pour 東京 warehouse", + "SELECT", + "\tid,", + "\t'naïve résumé' AS label, -- étiquette ✓", + "\tamount", + "FROM __ref(\"stg_sales_0\")", + "" + ], + "models/features/taxed_stg_sales_0.sql": [ + "SELECT id, ROUND(amount * 1.2, 2) AS taxed, ROUND(amount, 1) AS rounded", + "FROM __ref(\"stg_sales_0\")", + "" + ], + "models/fulfillment/marts/fulfillment_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount * (1 - 12345.678)) AS adjust_0_amount", + "FROM __ref(\"stg_fulfillment_1\") t", + "" + ], + "models/fulfillment/marts/fulfillment_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at", + "FROM __ref(\"stg_fulfillment_0\") t", + "" + ], + "models/fulfillment/staging/stg_fulfillment_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount * (1 - 12345.678)) AS adjust_0_amount,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_1_amount", + "FROM __source(\"raw_events_2\") t", + "" + ], + "models/fulfillment/staging/stg_fulfillment_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 3 AS priority,", + " (t.amount * (1 - 12345.678)) AS adjust_0_amount,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_1_amount", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/inventory/marts/inventory_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 3 AS priority,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_1_amount", + "FROM __ref(\"stg_inventory_1\") t", + "" + ], + "models/inventory/marts/inventory_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at", + "FROM __ref(\"stg_inventory_1\") t", + "" + ], + "models/inventory/staging/stg_inventory_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount + 2 + 1) AS adjust_2_amount", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/inventory/staging/stg_inventory_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'naïve résumé' AS site_label", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/rendering/large_events.sql": [ + "SELECT id, amount", + "FROM __table_fn(\"table_fn__events_above\")(1.5)", + "" + ], + "models/rendering/latest_raw_events_2.sql": [ + "SELECT id, amount", + "FROM (SELECT id, amount FROM __source(\"raw_events_2\") ORDER BY id DESC LIMIT 2) AS latest", + "" + ], + "models/rendering/stated_stg_fulfillment_1.sql": [ + "SELECT CAST(id AS INTEGER) AS id, status,", + " CASE WHEN amount >= 3 THEN 'HIGH'", + " ELSE 'LOW' END AS tier", + "FROM __ref(\"stg_fulfillment_1\")", + "" + ], + "models/rendering/unioned_event_ids.sql": [ + "SELECT id", + "FROM (SELECT id FROM __ref(\"stg_fulfillment_0\") UNION ALL SELECT id FROM __ref(\"stg_fulfillment_1\")) AS unioned", + "" + ], + "models/sales/marts/sales_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 3 AS priority,", + " 'naïve résumé' AS site_label", + "FROM __ref(\"stg_sales_0\") t", + "WHERE t.status <> 'returned ✓'", + "" + ], + "models/sales/staging/stg_sales_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount + 117 AS threshold_0_amount", + "FROM __source(\"raw_events_1\") t", + "" + ], + "tests/macro taxes_amounts/taxes_amounts.sql": [ + "WITH input_values AS (SELECT 10 AS amount),", + "__actual__macro_taxes_amounts AS (SELECT ROUND(amount * 1.2, 2) AS taxed", + " FROM input_values),", + "__expected__macro_taxes_amounts AS (SELECT 12.0 AS taxed)", + "SELECT 0 AS step_index, 'macro taxes_amounts' AS model_name, (SELECT COUNT(*) FROM __actual__macro_taxes_amounts) AS actual_count, (SELECT COUNT(*) FROM __expected__macro_taxes_amounts) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__macro_taxes_amounts EXCEPT SELECT * FROM __expected__macro_taxes_amounts) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__macro_taxes_amounts EXCEPT SELECT * FROM __actual__macro_taxes_amounts) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/regional_stg_inventory_0/test_regional_stg_inventory_0.sql": [ + "WITH __ref__stg_inventory_0 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__regional_stg_inventory_0 AS (SELECT id, amount, 'west' AS region", + "FROM __ref__stg_inventory_0),", + "__actual__regional_stg_inventory_0 AS (SELECT * FROM __ref__regional_stg_inventory_0),", + "__expected__regional_stg_inventory_0 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'west' AS region)", + "SELECT 0 AS step_index, 'regional_stg_inventory_0' AS model_name, (SELECT COUNT(*) FROM __actual__regional_stg_inventory_0) AS actual_count, (SELECT COUNT(*) FROM __expected__regional_stg_inventory_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __actual__regional_stg_inventory_0 EXCEPT SELECT id, amount, region FROM __expected__regional_stg_inventory_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __expected__regional_stg_inventory_0 EXCEPT SELECT id, amount, region FROM __actual__regional_stg_inventory_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/stg_fulfillment_0/test_stg_fulfillment_0.sql": [ + "WITH __source__raw_events_2 AS (SELECT 1 AS id, CAST(10 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_fulfillment_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount * (1 - 12345.678)) AS adjust_0_amount,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_1_amount", + "FROM __source__raw_events_2 t),", + "__actual__stg_fulfillment_0 AS (SELECT * FROM __ref__stg_fulfillment_0),", + "__expected__stg_fulfillment_0 AS (SELECT 1 AS id, 'placed' AS status)", + "SELECT 0 AS step_index, 'stg_fulfillment_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_fulfillment_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_fulfillment_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __actual__stg_fulfillment_0 EXCEPT SELECT id, status FROM __expected__stg_fulfillment_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __expected__stg_fulfillment_0 EXCEPT SELECT id, status FROM __actual__stg_fulfillment_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/udf detects_placed_events/detects_placed_events.sql": [ + "WITH input_values AS (SELECT 'placed' AS event_status),", + "__actual__udf_detects_placed_events AS (SELECT event_status, main.is_placed(event_status) AS is_placed", + " FROM input_values),", + "__expected__udf_detects_placed_events AS (SELECT 'placed' AS event_status, TRUE AS is_placed)", + "SELECT 0 AS step_index, 'udf detects_placed_events' AS model_name, (SELECT COUNT(*) FROM __actual__udf_detects_placed_events) AS actual_count, (SELECT COUNT(*) FROM __expected__udf_detects_placed_events) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__udf_detects_placed_events EXCEPT SELECT * FROM __expected__udf_detects_placed_events) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__udf_detects_placed_events EXCEPT SELECT * FROM __actual__udf_detects_placed_events) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.generated_10.chain_1_stg_sales_0": { + "database": null, + "schema": "main", + "name": "chain_1_stg_sales_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/analysis/chain_1_stg_sales_0.sql", + "original_file_path": "models/analysis/chain_1_stg_sales_0.sql", + "unique_id": "model.generated_10.chain_1_stg_sales_0", + "fqn": [ + "generated_10", + "models", + "analysis", + "chain_1_stg_sales_0" + ], + "alias": "chain_1_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Level 1 below the contracted copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.chain_1_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.contracted_stg_sales_0" + ] + } + }, + "model.generated_10.chain_2_stg_sales_0": { + "database": null, + "schema": "main", + "name": "chain_2_stg_sales_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/analysis/chain_2_stg_sales_0.sql", + "original_file_path": "models/analysis/chain_2_stg_sales_0.sql", + "unique_id": "model.generated_10.chain_2_stg_sales_0", + "fqn": [ + "generated_10", + "models", + "analysis", + "chain_2_stg_sales_0" + ], + "alias": "chain_2_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Level 2 below the contracted copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.chain_2_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.chain_1_stg_sales_0" + ] + } + }, + "model.generated_10.chain_3_stg_sales_0": { + "database": null, + "schema": "main", + "name": "chain_3_stg_sales_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/analysis/chain_3_stg_sales_0.sql", + "original_file_path": "models/analysis/chain_3_stg_sales_0.sql", + "unique_id": "model.generated_10.chain_3_stg_sales_0", + "fqn": [ + "generated_10", + "models", + "analysis", + "chain_3_stg_sales_0" + ], + "alias": "chain_3_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Level 3 below the contracted copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.chain_3_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.chain_2_stg_sales_0" + ] + } + }, + "model.generated_10.checked_stg_fulfillment_0": { + "database": null, + "schema": "main", + "name": "checked_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/analysis/checked_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/checked_stg_fulfillment_0.sql", + "unique_id": "model.generated_10.checked_stg_fulfillment_0", + "fqn": [ + "generated_10", + "models", + "analysis", + "checked_stg_fulfillment_0" + ], + "alias": "checked_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Metadata-checked copy of stg_fulfillment_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.checked_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_fulfillment_0" + ] + } + }, + "model.generated_10.contracted_stg_sales_0": { + "database": null, + "schema": "main", + "name": "contracted_stg_sales_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/analysis/contracted_stg_sales_0.sql", + "original_file_path": "models/analysis/contracted_stg_sales_0.sql", + "unique_id": "model.generated_10.contracted_stg_sales_0", + "fqn": [ + "generated_10", + "models", + "analysis", + "contracted_stg_sales_0" + ], + "alias": "contracted_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Contracted copy of raw_events_1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR(34)", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.contracted_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_10.raw_events_1" + ] + } + }, + "model.generated_10.regional_stg_inventory_0": { + "database": null, + "schema": "main", + "name": "regional_stg_inventory_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/analysis/regional_stg_inventory_0.sql", + "original_file_path": "models/analysis/regional_stg_inventory_0.sql", + "unique_id": "model.generated_10.regional_stg_inventory_0", + "fqn": [ + "generated_10", + "models", + "analysis", + "regional_stg_inventory_0" + ], + "alias": "regional_stg_inventory_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Regional copy of stg_inventory_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.regional_stg_inventory_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_inventory_0" + ] + } + }, + "model.generated_10.audited_stg_fulfillment_1": { + "database": null, + "schema": "main", + "name": "audited_stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/features/audited_stg_fulfillment_1.sql", + "original_file_path": "models/features/audited_stg_fulfillment_1.sql", + "unique_id": "model.generated_10.audited_stg_fulfillment_1", + "fqn": [ + "generated_10", + "models", + "features", + "audited_stg_fulfillment_1" + ], + "alias": "audited_stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Factory-audited copy of stg_fulfillment_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.audited_stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_fulfillment_1" + ] + } + }, + "model.generated_10.check_history_stg_fulfillment_1": { + "database": null, + "schema": "main", + "name": "check_history_stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/features/check_history_stg_fulfillment_1.sql", + "original_file_path": "models/features/check_history_stg_fulfillment_1.sql", + "unique_id": "model.generated_10.check_history_stg_fulfillment_1", + "fqn": [ + "generated_10", + "models", + "features", + "check_history_stg_fulfillment_1" + ], + "alias": "check_history_stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "snapshot", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Check history of stg_fulfillment_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.check_history_stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_fulfillment_1" + ] + } + }, + "model.generated_10.copied_stg_sales_0": { + "database": null, + "schema": "main", + "name": "copied_stg_sales_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/features/copied_stg_sales_0.sql", + "original_file_path": "models/features/copied_stg_sales_0.sql", + "unique_id": "model.generated_10.copied_stg_sales_0", + "fqn": [ + "generated_10", + "models", + "features", + "copied_stg_sales_0" + ], + "alias": "copied_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "copy_table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Custom copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.copied_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_sales_0" + ] + } + }, + "model.generated_10.flagged_stg_inventory_1": { + "database": null, + "schema": "main", + "name": "flagged_stg_inventory_1", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/features/flagged_stg_inventory_1.sql", + "original_file_path": "models/features/flagged_stg_inventory_1.sql", + "unique_id": "model.generated_10.flagged_stg_inventory_1", + "fqn": [ + "generated_10", + "models", + "features", + "flagged_stg_inventory_1" + ], + "alias": "flagged_stg_inventory_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Function-flagged copy of stg_inventory_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.flagged_stg_inventory_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.is_placed", + "model.generated_10.is_large", + "model.generated_10.stg_inventory_1" + ] + } + }, + "model.generated_10.guarded_stg_inventory_1": { + "database": null, + "schema": "main", + "name": "guarded_stg_inventory_1", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/features/guarded_stg_inventory_1.sql", + "original_file_path": "models/features/guarded_stg_inventory_1.sql", + "unique_id": "model.generated_10.guarded_stg_inventory_1", + "fqn": [ + "generated_10", + "models", + "features", + "guarded_stg_inventory_1" + ], + "alias": "guarded_stg_inventory_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Generic-audited copy of stg_inventory_1", + "columns": { + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.guarded_stg_inventory_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_inventory_1" + ] + } + }, + "model.generated_10.merge_stg_sales_0": { + "database": null, + "schema": "main", + "name": "merge_stg_sales_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/features/merge_stg_sales_0.sql", + "original_file_path": "models/features/merge_stg_sales_0.sql", + "unique_id": "model.generated_10.merge_stg_sales_0", + "fqn": [ + "generated_10", + "models", + "features", + "merge_stg_sales_0" + ], + "alias": "merge_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "merge", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Incremental merge copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.merge_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_sales_0" + ] + } + }, + "model.generated_10.product_labels": { + "database": null, + "schema": "main", + "name": "product_labels", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/features/product_labels.sql", + "original_file_path": "models/features/product_labels.sql", + "unique_id": "model.generated_10.product_labels", + "fqn": [ + "generated_10", + "models", + "features", + "product_labels" + ], + "alias": "product_labels", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Product labels from the loader", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.product_labels", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_10.loaded_products" + ] + } + }, + "model.generated_10.spaced_stg_sales_0": { + "database": null, + "schema": "main", + "name": "spaced_stg_sales_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/features/spaced_stg_sales_0.sql", + "original_file_path": "models/features/spaced_stg_sales_0.sql", + "unique_id": "model.generated_10.spaced_stg_sales_0", + "fqn": [ + "generated_10", + "models", + "features", + "spaced_stg_sales_0" + ], + "alias": "spaced_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "línea", + "東京" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "línea", + "東京" + ], + "description": "Copy of stg_sales_0 with café ☕ counter", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.spaced_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_sales_0" + ] + } + }, + "model.generated_10.taxed_stg_sales_0": { + "database": null, + "schema": "main", + "name": "taxed_stg_sales_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/features/taxed_stg_sales_0.sql", + "original_file_path": "models/features/taxed_stg_sales_0.sql", + "unique_id": "model.generated_10.taxed_stg_sales_0", + "fqn": [ + "generated_10", + "models", + "features", + "taxed_stg_sales_0" + ], + "alias": "taxed_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Taxed copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.taxed_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_sales_0" + ] + } + }, + "model.generated_10.fulfillment_summary_0": { + "database": null, + "schema": "main", + "name": "fulfillment_summary_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/fulfillment/marts/fulfillment_summary_0.sql", + "original_file_path": "models/fulfillment/marts/fulfillment_summary_0.sql", + "unique_id": "model.generated_10.fulfillment_summary_0", + "fqn": [ + "generated_10", + "models", + "fulfillment", + "marts", + "fulfillment_summary_0" + ], + "alias": "fulfillment_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "fulfillment", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "fulfillment", + "marts" + ], + "description": "Summary of fulfillment activity 0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.fulfillment_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_fulfillment_1" + ] + } + }, + "model.generated_10.fulfillment_summary_1": { + "database": null, + "schema": "main", + "name": "fulfillment_summary_1", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/fulfillment/marts/fulfillment_summary_1.sql", + "original_file_path": "models/fulfillment/marts/fulfillment_summary_1.sql", + "unique_id": "model.generated_10.fulfillment_summary_1", + "fqn": [ + "generated_10", + "models", + "fulfillment", + "marts", + "fulfillment_summary_1" + ], + "alias": "fulfillment_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "fulfillment", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "fulfillment", + "marts" + ], + "description": "Summary of fulfillment activity 1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.fulfillment_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_fulfillment_0" + ] + } + }, + "model.generated_10.stg_fulfillment_0": { + "database": null, + "schema": "main", + "name": "stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/fulfillment/staging/stg_fulfillment_0.sql", + "original_file_path": "models/fulfillment/staging/stg_fulfillment_0.sql", + "unique_id": "model.generated_10.stg_fulfillment_0", + "fqn": [ + "generated_10", + "models", + "fulfillment", + "staging", + "stg_fulfillment_0" + ], + "alias": "stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged fulfillment events 0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_10.raw_events_2" + ] + } + }, + "model.generated_10.stg_fulfillment_1": { + "database": null, + "schema": "main", + "name": "stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/fulfillment/staging/stg_fulfillment_1.sql", + "original_file_path": "models/fulfillment/staging/stg_fulfillment_1.sql", + "unique_id": "model.generated_10.stg_fulfillment_1", + "fqn": [ + "generated_10", + "models", + "fulfillment", + "staging", + "stg_fulfillment_1" + ], + "alias": "stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged fulfillment events 1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_10.raw_events_0" + ] + } + }, + "model.generated_10.inventory_summary_0": { + "database": null, + "schema": "main", + "name": "inventory_summary_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/inventory/marts/inventory_summary_0.sql", + "original_file_path": "models/inventory/marts/inventory_summary_0.sql", + "unique_id": "model.generated_10.inventory_summary_0", + "fqn": [ + "generated_10", + "models", + "inventory", + "marts", + "inventory_summary_0" + ], + "alias": "inventory_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "inventory", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'main.inventory_summary_0' AS refreshed_relation, 'café ☕ counter' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'main.inventory_summary_0' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "inventory", + "marts" + ], + "description": "Summary of inventory activity 0 (東京 warehouse)", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'main.inventory_summary_0' AS refreshed_relation, 'café ☕ counter' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "café ☕ counter" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'main.inventory_summary_0' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.inventory_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_inventory_1" + ] + } + }, + "model.generated_10.inventory_summary_1": { + "database": null, + "schema": "main", + "name": "inventory_summary_1", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/inventory/marts/inventory_summary_1.sql", + "original_file_path": "models/inventory/marts/inventory_summary_1.sql", + "unique_id": "model.generated_10.inventory_summary_1", + "fqn": [ + "generated_10", + "models", + "inventory", + "marts", + "inventory_summary_1" + ], + "alias": "inventory_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "inventory", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'main.inventory_summary_1' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'main.inventory_summary_1' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "inventory", + "marts" + ], + "description": "Summary of inventory activity 1", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'main.inventory_summary_1' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "Ελληνικά orders" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'main.inventory_summary_1' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.inventory_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_inventory_1" + ] + } + }, + "model.generated_10.stg_inventory_0": { + "database": null, + "schema": "main", + "name": "stg_inventory_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/inventory/staging/stg_inventory_0.sql", + "original_file_path": "models/inventory/staging/stg_inventory_0.sql", + "unique_id": "model.generated_10.stg_inventory_0", + "fqn": [ + "generated_10", + "models", + "inventory", + "staging", + "stg_inventory_0" + ], + "alias": "stg_inventory_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged inventory events 0 (café ☕ counter)", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_inventory_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_10.raw_events_0" + ] + } + }, + "model.generated_10.stg_inventory_1": { + "database": null, + "schema": "main", + "name": "stg_inventory_1", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/inventory/staging/stg_inventory_1.sql", + "original_file_path": "models/inventory/staging/stg_inventory_1.sql", + "unique_id": "model.generated_10.stg_inventory_1", + "fqn": [ + "generated_10", + "models", + "inventory", + "staging", + "stg_inventory_1" + ], + "alias": "stg_inventory_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged inventory events 1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_inventory_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_10.raw_events_0" + ] + } + }, + "model.generated_10.large_events": { + "database": null, + "schema": "main", + "name": "large_events", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/rendering/large_events.sql", + "original_file_path": "models/rendering/large_events.sql", + "unique_id": "model.generated_10.large_events", + "fqn": [ + "generated_10", + "models", + "rendering", + "large_events" + ], + "alias": "large_events", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Events above a threshold from a table function", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.large_events", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.table_fn__events_above" + ] + } + }, + "model.generated_10.latest_raw_events_2": { + "database": null, + "schema": "main", + "name": "latest_raw_events_2", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/rendering/latest_raw_events_2.sql", + "original_file_path": "models/rendering/latest_raw_events_2.sql", + "unique_id": "model.generated_10.latest_raw_events_2", + "fqn": [ + "generated_10", + "models", + "rendering", + "latest_raw_events_2" + ], + "alias": "latest_raw_events_2", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Newest rows of raw_events_2", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.latest_raw_events_2", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_10.raw_events_2" + ] + } + }, + "model.generated_10.stated_stg_fulfillment_1": { + "database": null, + "schema": "main", + "name": "stated_stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/rendering/stated_stg_fulfillment_1.sql", + "original_file_path": "models/rendering/stated_stg_fulfillment_1.sql", + "unique_id": "model.generated_10.stated_stg_fulfillment_1", + "fqn": [ + "generated_10", + "models", + "rendering", + "stated_stg_fulfillment_1" + ], + "alias": "stated_stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Enum-typed copy of stg_fulfillment_1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "tier": { + "name": "tier", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stated_stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_fulfillment_1" + ] + } + }, + "model.generated_10.unioned_event_ids": { + "database": null, + "schema": "main", + "name": "unioned_event_ids", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/rendering/unioned_event_ids.sql", + "original_file_path": "models/rendering/unioned_event_ids.sql", + "unique_id": "model.generated_10.unioned_event_ids", + "fqn": [ + "generated_10", + "models", + "rendering", + "unioned_event_ids" + ], + "alias": "unioned_event_ids", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Ids from two staged relations", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.unioned_event_ids", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_fulfillment_0", + "model.generated_10.stg_fulfillment_1" + ] + } + }, + "model.generated_10.sales_summary_0": { + "database": null, + "schema": "main", + "name": "sales_summary_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/sales/marts/sales_summary_0.sql", + "original_file_path": "models/sales/marts/sales_summary_0.sql", + "unique_id": "model.generated_10.sales_summary_0", + "fqn": [ + "generated_10", + "models", + "sales", + "marts", + "sales_summary_0" + ], + "alias": "sales_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "sales", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'main.sales_summary_0' AS refreshed_relation, 'Zürich – depot' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'main.sales_summary_0' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "sales", + "marts" + ], + "description": "Summary of sales activity 0", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'main.sales_summary_0' AS refreshed_relation, 'Zürich – depot' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "Zürich – depot" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'main.sales_summary_0' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.sales_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_10.stg_sales_0" + ] + } + }, + "model.generated_10.stg_sales_0": { + "database": null, + "schema": "main", + "name": "stg_sales_0", + "resource_type": "model", + "package_name": "generated_10", + "path": "models/sales/staging/stg_sales_0.sql", + "original_file_path": "models/sales/staging/stg_sales_0.sql", + "unique_id": "model.generated_10.stg_sales_0", + "fqn": [ + "generated_10", + "models", + "sales", + "staging", + "stg_sales_0" + ], + "alias": "stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged sales events 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_10.raw_events_1" + ] + } + } + }, + "sources": { + "source.generated_10.loaded_products": { + "database": null, + "schema": "main", + "name": "loaded_products", + "resource_type": "source", + "package_name": "generated_10", + "path": "sources/managed.yml", + "original_file_path": "sources/managed.yml", + "unique_id": "source.generated_10.loaded_products", + "fqn": [ + "generated_10", + "loaded_products" + ], + "source_name": "loaded_products", + "source_description": "", + "loader": "", + "identifier": "loaded_products", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Products loaded by a project loader.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "loaded_products", + "auto_load": false, + "write_strategy": "table" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_10.raw_events_0": { + "database": null, + "schema": "", + "name": "raw_events_0", + "resource_type": "source", + "package_name": "generated_10", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_10.raw_events_0", + "fqn": [ + "generated_10", + "raw_events_0" + ], + "source_name": "raw_events_0", + "source_description": "", + "loader": "", + "identifier": "raw_events_0", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_10.raw_events_1": { + "database": null, + "schema": "", + "name": "raw_events_1", + "resource_type": "source", + "package_name": "generated_10", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_10.raw_events_1", + "fqn": [ + "generated_10", + "raw_events_1" + ], + "source_name": "raw_events_1", + "source_description": "", + "loader": "", + "identifier": "raw_events_1", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 1.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_10.raw_events_2": { + "database": null, + "schema": "", + "name": "raw_events_2", + "resource_type": "source", + "package_name": "generated_10", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_10.raw_events_2", + "fqn": [ + "generated_10", + "raw_events_2" + ], + "source_name": "raw_events_2", + "source_description": "", + "loader": "", + "identifier": "raw_events_2", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 2.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.generated_10.adjust_1": { + "name": "adjust_1", + "resource_type": "macro", + "package_name": "generated_10", + "path": "macros/adjust_1.py", + "original_file_path": "macros/adjust_1.py", + "unique_id": "macro.generated_10.adjust_1", + "macro_sql": "def adjust_1_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_1(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_1_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [ + "macro.generated_10.adjust_1_round" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_10.adjust_1_round": { + "name": "adjust_1_round", + "resource_type": "macro", + "package_name": "generated_10", + "path": "macros/adjust_1.py", + "original_file_path": "macros/adjust_1.py", + "unique_id": "macro.generated_10.adjust_1_round", + "macro_sql": "def adjust_1_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_1(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_1_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_10.round_amount": { + "name": "round_amount", + "resource_type": "macro", + "package_name": "generated_10", + "path": "macros/rounding.py", + "original_file_path": "macros/rounding.py", + "unique_id": "macro.generated_10.round_amount", + "macro_sql": "def round_amount(expression: str, places: int = 2) -> str:\n \"\"\"Round an amount.\"\"\"\n return f\"ROUND({expression}, {places})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_10.taxed": { + "name": "taxed", + "resource_type": "macro", + "package_name": "generated_10", + "path": "macros/tax.py", + "original_file_path": "macros/tax.py", + "unique_id": "macro.generated_10.taxed", + "macro_sql": "from macros.rounding import round_amount\n\n\ndef taxed(expression: str) -> str:\n \"\"\"Add tax to an amount, rounded.\"\"\"\n return round_amount(f\"{expression} * 1.2\")\n", + "depends_on": { + "macros": [ + "macro.generated_10.round_amount" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_10.analysis_region": { + "name": "analysis_region", + "resource_type": "macro", + "package_name": "generated_10", + "path": "models/analysis/_sqlbuild/_macros/regions.py", + "original_file_path": "models/analysis/_sqlbuild/_macros/regions.py", + "unique_id": "macro.generated_10.analysis_region", + "macro_sql": "def analysis_region() -> str:\n \"\"\"Return the region rows are assigned to.\"\"\"\n return \"'north'\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/analysis" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_10.adjust_0": { + "name": "adjust_0", + "resource_type": "macro", + "package_name": "generated_10", + "path": "models/fulfillment/_sqlbuild/macros/adjust_0.py", + "original_file_path": "models/fulfillment/_sqlbuild/macros/adjust_0.py", + "unique_id": "macro.generated_10.adjust_0", + "macro_sql": "def adjust_0(ctx, expression: str) -> str:\n \"\"\"Scale an amount by the configured discount.\"\"\"\n rate = ctx.vars[\"discount_rate\"]\n return f\"({expression} * (1 - {rate}))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "inherited", + "sqlbuild_scope_path": "models/fulfillment" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_10.adjust_2": { + "name": "adjust_2", + "resource_type": "macro", + "package_name": "generated_10", + "path": "models/inventory/staging/_sqlbuild/_macros/adjust_2.py", + "original_file_path": "models/inventory/staging/_sqlbuild/_macros/adjust_2.py", + "unique_id": "macro.generated_10.adjust_2", + "macro_sql": "def adjust_2(expression: str) -> str:\n \"\"\"Offset an amount.\"\"\"\n return f\"({expression} + 2 + 1)\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/inventory/staging" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_10.latest_rows": { + "name": "latest_rows", + "resource_type": "macro", + "package_name": "generated_10", + "path": "models/rendering/_sqlbuild/_macros/relations.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/relations.py", + "unique_id": "macro.generated_10.latest_rows", + "macro_sql": "from sqlbuild.refs import SqlResourceRef\n\n\ndef union_ids(relations: list[SqlResourceRef]) -> str:\n \"\"\"Union the ids of several relations.\"\"\"\n selects = [f\"SELECT id FROM {relation}\" for relation in relations]\n return \" UNION ALL \".join(selects)\n\n\ndef latest_rows(relation: SqlResourceRef, limit: int = 2) -> str:\n \"\"\"Return the newest rows of one relation.\"\"\"\n return f\"(SELECT id, amount FROM {relation} ORDER BY id DESC LIMIT {limit})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_10.union_ids": { + "name": "union_ids", + "resource_type": "macro", + "package_name": "generated_10", + "path": "models/rendering/_sqlbuild/_macros/relations.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/relations.py", + "unique_id": "macro.generated_10.union_ids", + "macro_sql": "from sqlbuild.refs import SqlResourceRef\n\n\ndef union_ids(relations: list[SqlResourceRef]) -> str:\n \"\"\"Union the ids of several relations.\"\"\"\n selects = [f\"SELECT id FROM {relation}\" for relation in relations]\n return \" UNION ALL \".join(selects)\n\n\ndef latest_rows(relation: SqlResourceRef, limit: int = 2) -> str:\n \"\"\"Return the newest rows of one relation.\"\"\"\n return f\"(SELECT id, amount FROM {relation} ORDER BY id DESC LIMIT {limit})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_10__sqlbuild_hooks.record_refresh": { + "name": "record_refresh", + "resource_type": "macro", + "package_name": "generated_10__sqlbuild_hooks", + "path": "hooks/sql/record_refresh.sql", + "original_file_path": "hooks/sql/record_refresh.sql", + "unique_id": "macro.generated_10__sqlbuild_hooks.record_refresh", + "macro_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "depends_on": { + "macros": [] + }, + "description": "Record a refresh for one relation", + "meta": { + "sqlbuild_resource_type": "sql_hook", + "sqlbuild_hook_name": "record_refresh" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.generated_10.chain_1_stg_sales_0": [ + "model.generated_10.contracted_stg_sales_0" + ], + "model.generated_10.chain_2_stg_sales_0": [ + "model.generated_10.chain_1_stg_sales_0" + ], + "model.generated_10.chain_3_stg_sales_0": [ + "model.generated_10.chain_2_stg_sales_0" + ], + "model.generated_10.checked_stg_fulfillment_0": [ + "model.generated_10.stg_fulfillment_0" + ], + "model.generated_10.contracted_stg_sales_0": [ + "source.generated_10.raw_events_1" + ], + "model.generated_10.regional_stg_inventory_0": [ + "model.generated_10.stg_inventory_0" + ], + "model.generated_10.audited_stg_fulfillment_1": [ + "model.generated_10.stg_fulfillment_1" + ], + "model.generated_10.check_history_stg_fulfillment_1": [ + "model.generated_10.stg_fulfillment_1" + ], + "model.generated_10.copied_stg_sales_0": [ + "model.generated_10.stg_sales_0" + ], + "model.generated_10.flagged_stg_inventory_1": [ + "model.generated_10.is_placed", + "model.generated_10.is_large", + "model.generated_10.stg_inventory_1" + ], + "model.generated_10.guarded_stg_inventory_1": [ + "model.generated_10.stg_inventory_1" + ], + "model.generated_10.merge_stg_sales_0": [ + "model.generated_10.stg_sales_0" + ], + "model.generated_10.product_labels": [ + "source.generated_10.loaded_products" + ], + "model.generated_10.spaced_stg_sales_0": [ + "model.generated_10.stg_sales_0" + ], + "model.generated_10.taxed_stg_sales_0": [ + "model.generated_10.stg_sales_0" + ], + "model.generated_10.fulfillment_summary_0": [ + "model.generated_10.stg_fulfillment_1" + ], + "model.generated_10.fulfillment_summary_1": [ + "model.generated_10.stg_fulfillment_0" + ], + "model.generated_10.stg_fulfillment_0": [ + "source.generated_10.raw_events_2" + ], + "model.generated_10.stg_fulfillment_1": [ + "source.generated_10.raw_events_0" + ], + "model.generated_10.inventory_summary_0": [ + "model.generated_10.stg_inventory_1" + ], + "model.generated_10.inventory_summary_1": [ + "model.generated_10.stg_inventory_1" + ], + "model.generated_10.stg_inventory_0": [ + "source.generated_10.raw_events_0" + ], + "model.generated_10.stg_inventory_1": [ + "source.generated_10.raw_events_0" + ], + "model.generated_10.large_events": [ + "model.generated_10.table_fn__events_above" + ], + "model.generated_10.latest_raw_events_2": [ + "source.generated_10.raw_events_2" + ], + "model.generated_10.stated_stg_fulfillment_1": [ + "model.generated_10.stg_fulfillment_1" + ], + "model.generated_10.unioned_event_ids": [ + "model.generated_10.stg_fulfillment_0", + "model.generated_10.stg_fulfillment_1" + ], + "model.generated_10.sales_summary_0": [ + "model.generated_10.stg_sales_0" + ], + "model.generated_10.stg_sales_0": [ + "source.generated_10.raw_events_1" + ], + "source.generated_10.loaded_products": [], + "source.generated_10.raw_events_0": [], + "source.generated_10.raw_events_1": [], + "source.generated_10.raw_events_2": [], + "model.generated_10.is_placed": [], + "model.generated_10.table_fn__events_above": [ + "model.generated_10.stg_inventory_0" + ], + "model.generated_10.is_large": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/seed/11.json b/tests/goldens/compiler/seed/11.json new file mode 100644 index 0000000000..fb6be39da4 --- /dev/null +++ b/tests/goldens/compiler/seed/11.json @@ -0,0 +1,45 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D002", + "message": "MODEL(...) in '/models/fulfillment/marts/fulfillment_summary_0.sql' contains invalid SQLBuild header syntax: expected key at position 267" + } + ] + }, + { + "label": "compile-store-warm", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "D002", + "message": "MODEL(...) in '/models/fulfillment/marts/fulfillment_summary_0.sql' contains invalid SQLBuild header syntax: expected key at position 267" + } + ] + }, + { + "label": "plan", + "exit_code": 1, + "diagnostics": [ + "Project discovery START", + "Project assembly START", + "Declaration parsing START", + "Declaration parsing FAIL ()", + "Project assembly FAIL ()", + "Project discovery FAIL ()", + "error[D002]: MODEL(...) in '/models/fulfillment/marts/fulfillment_summary_0.sql' contains invalid SQLBuild header syntax: expected key at position 267", + "", + "" + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/seed/2.json b/tests/goldens/compiler/seed/2.json new file mode 100644 index 0000000000..67c315c293 --- /dev/null +++ b/tests/goldens/compiler/seed/2.json @@ -0,0 +1,84 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Model file models/sales/marts/sales_summary_1.sql references unknown model 'missing_model'" + } + ] + }, + { + "label": "compile-store-warm", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Model file models/sales/marts/sales_summary_1.sql references unknown model 'missing_model'" + } + ] + }, + { + "label": "plan", + "exit_code": 1, + "diagnostics": [ + "Project discovery START", + "Project assembly START", + "Declaration parsing START", + "Declaration parsing OK ()", + "Python discovery START", + "Python discovery OK ()", + "Project assembly OK ()", + "Project discovery OK ()", + "Compiling project...", + "error[P001]: Model file models/sales/marts/sales_summary_1.sql references unknown model 'missing_model'", + "", + "" + ] + }, + { + "label": "compile-select", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Model file models/sales/marts/sales_summary_1.sql references unknown model 'missing_model'" + } + ] + }, + { + "label": "compile-no-analysis", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Model file models/sales/marts/sales_summary_1.sql references unknown model 'missing_model'" + } + ] + }, + { + "label": "compile-rich-lineage", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Model file models/sales/marts/sales_summary_1.sql references unknown model 'missing_model'" + } + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/seed/3.json b/tests/goldens/compiler/seed/3.json new file mode 100644 index 0000000000..ca042e5bf8 --- /dev/null +++ b/tests/goldens/compiler/seed/3.json @@ -0,0 +1,2396 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-store-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "audits/generic/audited_event_totals/amount_floor.sql": [ + "SELECT *", + "FROM __ref(\"audited_event_totals\")", + "WHERE amount < -23", + "" + ], + "audits/generic/audited_events/accepted_values__id.sql": [ + "SELECT id", + "FROM __source(\"audited_events\")", + "WHERE id IS NOT NULL", + " AND id NOT IN (1, 2)", + "" + ], + "audits/generic/audited_events/not_null__id.sql": [ + "SELECT id", + "FROM __source(\"audited_events\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/audited_events/unique__id.sql": [ + "SELECT id, COUNT(*) AS duplicate_count", + "FROM __source(\"audited_events\")", + "WHERE id IS NOT NULL", + "GROUP BY id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/billing_summary_1/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"billing_summary_1\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/channel_codes/not_null__id.sql": [ + "SELECT id", + "FROM __seed(\"channel_codes\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/checked_stg_billing_1/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"checked_stg_billing_1\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'expédié', '取消', 'returned ✓')", + "" + ], + "audits/generic/checked_stg_billing_1/expression_is_true.sql": [ + "SELECT *", + "FROM __ref(\"checked_stg_billing_1\")", + "WHERE NOT (amount >= -1000)", + "" + ], + "audits/generic/checked_stg_billing_1/relationships__id.sql": [ + "SELECT id", + "FROM __ref(\"checked_stg_billing_1\")", + "WHERE id IS NOT NULL", + " AND id NOT IN (", + " SELECT id", + " FROM __ref(\"stg_billing_1\")", + " WHERE id IS NOT NULL", + " )", + "" + ], + "audits/generic/configured_events/accepted_values__id.sql": [ + "SELECT id", + "FROM __source(\"configured_events\")", + "WHERE id IS NOT NULL", + " AND id NOT IN ('1')", + "" + ], + "audits/generic/configured_stg_billing_1/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"configured_stg_billing_1\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'shipped')", + "" + ], + "audits/generic/configured_stg_billing_1/configured_amount_floor.sql": [ + "SELECT *", + "FROM __ref(\"configured_stg_billing_1\")", + "WHERE amount < -25", + "" + ], + "audits/generic/configured_stg_billing_1/configured_id_present__id.sql": [ + "SELECT id", + "FROM __ref(\"configured_stg_billing_1\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/configured_stg_billing_1/unique__id.sql": [ + "SELECT id, COUNT(*) AS duplicate_count", + "FROM __ref(\"configured_stg_billing_1\")", + "WHERE id IS NOT NULL", + "GROUP BY id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/stg_billing_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_billing_0\")", + "WHERE id IS NULL", + "" + ], + "functions/sql/configured_label.sql": [ + "CREATE OR REPLACE MACRO main.configured_label(raw_status) AS (", + "UPPER(raw_status)", + ")", + "" + ], + "functions/sql/scaled_amount.sql": [ + "CREATE OR REPLACE MACRO main.scaled_amount(p_amount, p_factor) AS (", + "p_amount * p_factor", + ")", + "" + ], + "functions/sql/table_fn__amount_bands.sql": [ + "CREATE OR REPLACE MACRO main.table_fn__amount_bands(p_floor) AS TABLE", + "SELECT CAST(id AS INTEGER) AS id,", + " CASE WHEN amount > p_floor THEN 'high' ELSE 'low' END AS band", + "FROM __ref(\"stg_billing_1\")", + "" + ], + "models/analysis/banded_amounts.sql": [ + "SELECT bands.id, bands.band", + "FROM __table_fn(\"table_fn__amount_bands\")(8.5) AS bands", + "" + ], + "models/analysis/checked_stg_billing_1.sql": [ + "SELECT id, amount, status", + "FROM __ref(\"stg_billing_1\")", + "" + ], + "models/analysis/regional_stg_billing_1.sql": [ + "SELECT id, amount, 'east' AS region", + "FROM __ref(\"stg_billing_1\")", + "" + ], + "models/analysis/scaled_stg_billing_1.sql": [ + "SELECT id, __udf(\"scaled_amount\")(amount, 8) AS scaled_amount", + "FROM __ref(\"stg_billing_1\")", + "" + ], + "models/billing/marts/billing_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount + 299 AS threshold_2_amount,", + " (t.amount + 0 + 1) AS adjust_0_amount", + "FROM __ref(\"stg_billing_1\") t", + "LEFT JOIN __ref(\"stg_billing_0\") j1 ON t.id = j1.id", + "" + ], + "models/billing/marts/billing_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount + 299 AS threshold_2_amount", + "FROM __ref(\"stg_billing_1\") t", + "" + ], + "models/billing/staging/stg_billing_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount + 374 AS threshold_0_amount,", + " 'Zürich – depot' AS threshold_1_label", + "FROM __source(\"raw_events_2\") t", + "" + ], + "models/billing/staging/stg_billing_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'Zürich – depot' AS threshold_1_label,", + " t.amount + 299 AS threshold_2_amount,", + " (t.amount * (1 - 0.15)) AS adjust_1_amount", + "FROM __source(\"raw_events_2\") t", + "WHERE t.status <> 'expédié'", + "" + ], + "models/features/batched_watermark_stg_billing_1.sql": [ + "SELECT CAST(created_at AS DATE) AS created_at, SUM(amount) AS amount", + "FROM __ref(\"stg_billing_1\")", + "GROUP BY CAST(created_at AS DATE)", + "" + ], + "models/features/hooked_stg_billing_1.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_billing_1\")", + "" + ], + "models/features/kept_stg_billing_1.sql": [ + "SELECT id, status, amount * 0.5 AS weighted", + "FROM __ref(\"stg_billing_1\")", + "WHERE status IN ('取消', 'expédié')", + " AND amount * 1.0 IN (0.5, 1.25, 2500.75) OR id > 0", + "" + ], + "models/rendering/audited_event_totals.sql": [ + "SELECT c.label, SUM(e.amount) AS amount", + "FROM __source(\"audited_events\") e", + "JOIN __seed(\"channel_codes\") c ON e.id = c.id", + "GROUP BY c.label", + "" + ], + "models/rendering/configured_stg_billing_1.sql": [ + "SELECT id, amount, status", + "FROM __ref(\"stg_billing_1\")", + "" + ], + "models/rendering/interpolated_stg_billing_0.sql": [ + "SELECT id,", + " '東京 warehouse' AS site,", + " $$--東京 warehouse /* $$ AS site_note,", + " 'web-orders' AS channel,", + " amount * 0.15 AS discounted", + "FROM __ref(\"stg_billing_0\")", + "" + ], + "models/rendering/legacy_event_ids.sql": [ + "SELECT id", + "FROM __ref(\"stg_billing_1\") AS legacy", + "" + ], + "models/rendering/policy_stg_billing_1.sql": [ + "SELECT id, amount, ('web' || '/dev/generated_duckdb/south' || '@web-orders') AS channel,", + " 4 AS minimum_amount,", + " 'store' AS fallback_channel", + "FROM __ref(\"stg_billing_1\")", + "WHERE amount >= 4", + "" + ], + "models/rendering/windowed_stg_billing_0.sql": [ + "SELECT id, created_at", + "FROM __ref(\"stg_billing_0\")", + "WHERE CAST(created_at AS DATE) >= CAST(@@@window_start AS DATE)", + "" + ], + "tests/macro doubles_amounts/doubles_amounts.sql": [ + "WITH input_values AS (SELECT 4 AS amount),", + "__actual__macro_doubles_amounts AS (SELECT (amount * 2) AS doubled", + " FROM input_values),", + "__expected__macro_doubles_amounts AS (SELECT 8 AS doubled)", + "SELECT 0 AS step_index, 'macro doubles_amounts' AS model_name, (SELECT COUNT(*) FROM __actual__macro_doubles_amounts) AS actual_count, (SELECT COUNT(*) FROM __expected__macro_doubles_amounts) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__macro_doubles_amounts EXCEPT SELECT * FROM __expected__macro_doubles_amounts) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__macro_doubles_amounts EXCEPT SELECT * FROM __actual__macro_doubles_amounts) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/regional_stg_billing_1/test_regional_stg_billing_1.sql": [ + "WITH __ref__stg_billing_1 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__regional_stg_billing_1 AS (SELECT id, amount, 'west' AS region", + "FROM __ref__stg_billing_1),", + "__actual__regional_stg_billing_1 AS (SELECT * FROM __ref__regional_stg_billing_1),", + "__expected__regional_stg_billing_1 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'west' AS region)", + "SELECT 0 AS step_index, 'regional_stg_billing_1' AS model_name, (SELECT COUNT(*) FROM __actual__regional_stg_billing_1) AS actual_count, (SELECT COUNT(*) FROM __expected__regional_stg_billing_1) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __actual__regional_stg_billing_1 EXCEPT SELECT id, amount, region FROM __expected__regional_stg_billing_1) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __expected__regional_stg_billing_1 EXCEPT SELECT id, amount, region FROM __actual__regional_stg_billing_1) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/stg_billing_0/test_stg_billing_0.sql": [ + "WITH __source__raw_events_2 AS (SELECT 1 AS id, CAST(10 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_billing_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount + 374 AS threshold_0_amount,", + " 'Zürich – depot' AS threshold_1_label", + "FROM __source__raw_events_2 t),", + "__actual__stg_billing_0 AS (SELECT * FROM __ref__stg_billing_0),", + "__expected__stg_billing_0 AS (SELECT 1 AS id, 'placed' AS status)", + "SELECT 0 AS step_index, 'stg_billing_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_billing_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_billing_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __actual__stg_billing_0 EXCEPT SELECT id, status FROM __expected__stg_billing_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __expected__stg_billing_0 EXCEPT SELECT id, status FROM __actual__stg_billing_0) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.generated_3.banded_amounts": { + "database": null, + "schema": "main", + "name": "banded_amounts", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/analysis/banded_amounts.sql", + "original_file_path": "models/analysis/banded_amounts.sql", + "unique_id": "model.generated_3.banded_amounts", + "fqn": [ + "generated_3", + "models", + "analysis", + "banded_amounts" + ], + "alias": "banded_amounts", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Amount bands from a table function", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.banded_amounts", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.table_fn__amount_bands" + ] + } + }, + "model.generated_3.checked_stg_billing_1": { + "database": null, + "schema": "main", + "name": "checked_stg_billing_1", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/analysis/checked_stg_billing_1.sql", + "original_file_path": "models/analysis/checked_stg_billing_1.sql", + "unique_id": "model.generated_3.checked_stg_billing_1", + "fqn": [ + "generated_3", + "models", + "analysis", + "checked_stg_billing_1" + ], + "alias": "checked_stg_billing_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Metadata-checked copy of stg_billing_1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.checked_stg_billing_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.stg_billing_1" + ] + } + }, + "model.generated_3.regional_stg_billing_1": { + "database": null, + "schema": "main", + "name": "regional_stg_billing_1", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/analysis/regional_stg_billing_1.sql", + "original_file_path": "models/analysis/regional_stg_billing_1.sql", + "unique_id": "model.generated_3.regional_stg_billing_1", + "fqn": [ + "generated_3", + "models", + "analysis", + "regional_stg_billing_1" + ], + "alias": "regional_stg_billing_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Regional copy of stg_billing_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.regional_stg_billing_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.stg_billing_1" + ] + } + }, + "model.generated_3.scaled_stg_billing_1": { + "database": null, + "schema": "main", + "name": "scaled_stg_billing_1", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/analysis/scaled_stg_billing_1.sql", + "original_file_path": "models/analysis/scaled_stg_billing_1.sql", + "unique_id": "model.generated_3.scaled_stg_billing_1", + "fqn": [ + "generated_3", + "models", + "analysis", + "scaled_stg_billing_1" + ], + "alias": "scaled_stg_billing_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Scaled amounts of stg_billing_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.scaled_stg_billing_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.scaled_amount", + "model.generated_3.stg_billing_1" + ] + } + }, + "model.generated_3.billing_summary_0": { + "database": null, + "schema": "main", + "name": "billing_summary_0", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/billing/marts/billing_summary_0.sql", + "original_file_path": "models/billing/marts/billing_summary_0.sql", + "unique_id": "model.generated_3.billing_summary_0", + "fqn": [ + "generated_3", + "models", + "billing", + "marts", + "billing_summary_0" + ], + "alias": "billing_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of billing activity 0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.billing_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.stg_billing_1", + "model.generated_3.stg_billing_0" + ] + } + }, + "model.generated_3.billing_summary_1": { + "database": null, + "schema": "main", + "name": "billing_summary_1", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/billing/marts/billing_summary_1.sql", + "original_file_path": "models/billing/marts/billing_summary_1.sql", + "unique_id": "model.generated_3.billing_summary_1", + "fqn": [ + "generated_3", + "models", + "billing", + "marts", + "billing_summary_1" + ], + "alias": "billing_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'main.billing_summary_1' AS refreshed_relation, 'Zürich – depot' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'main.billing_summary_1' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of billing activity 1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'main.billing_summary_1' AS refreshed_relation, 'Zürich – depot' AS refresh_label", + "name": "record_refresh", + "relative_path": "models/billing/marts/_sqlbuild/_hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "Zürich – depot" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'main.billing_summary_1' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.billing_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.stg_billing_1" + ] + } + }, + "model.generated_3.stg_billing_0": { + "database": null, + "schema": "main", + "name": "stg_billing_0", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/billing/staging/stg_billing_0.sql", + "original_file_path": "models/billing/staging/stg_billing_0.sql", + "unique_id": "model.generated_3.stg_billing_0", + "fqn": [ + "generated_3", + "models", + "billing", + "staging", + "stg_billing_0" + ], + "alias": "stg_billing_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged billing events 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_billing_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_3.raw_events_2" + ] + } + }, + "model.generated_3.stg_billing_1": { + "database": null, + "schema": "main", + "name": "stg_billing_1", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/billing/staging/stg_billing_1.sql", + "original_file_path": "models/billing/staging/stg_billing_1.sql", + "unique_id": "model.generated_3.stg_billing_1", + "fqn": [ + "generated_3", + "models", + "billing", + "staging", + "stg_billing_1" + ], + "alias": "stg_billing_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged billing events 1 (Zürich – depot)", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_billing_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_3.raw_events_2" + ] + } + }, + "model.generated_3.batched_watermark_stg_billing_1": { + "database": null, + "schema": "main", + "name": "batched_watermark_stg_billing_1", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/features/batched_watermark_stg_billing_1.sql", + "original_file_path": "models/features/batched_watermark_stg_billing_1.sql", + "unique_id": "model.generated_3.batched_watermark_stg_billing_1", + "fqn": [ + "generated_3", + "models", + "features", + "batched_watermark_stg_billing_1" + ], + "alias": "batched_watermark_stg_billing_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Microbatched watermark totals of stg_billing_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.batched_watermark_stg_billing_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.stg_billing_1" + ] + } + }, + "model.generated_3.hooked_stg_billing_1": { + "database": null, + "schema": "main", + "name": "hooked_stg_billing_1", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/features/hooked_stg_billing_1.sql", + "original_file_path": "models/features/hooked_stg_billing_1.sql", + "unique_id": "model.generated_3.hooked_stg_billing_1", + "fqn": [ + "generated_3", + "models", + "features", + "hooked_stg_billing_1" + ], + "alias": "hooked_stg_billing_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Hooked copy of stg_billing_1", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "python", + "name": "note_refresh", + "kwargs": { + "channel": "東京 warehouse" + }, + "relative_path": "models/features/_sqlbuild/_hooks/python/notify.py", + "definition_hash": "55440ff19f0c4f231ad57d453227a3c9d584b81234ee4b3338a39ccdf59814a8", + "version_hash": "03b4f786f8ab2736e5be2e4de5016bd16ea44d84beca000ec2a53a397e503eb6" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.hooked_stg_billing_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.stg_billing_1" + ] + } + }, + "model.generated_3.kept_stg_billing_1": { + "database": null, + "schema": "main", + "name": "kept_stg_billing_1", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/features/kept_stg_billing_1.sql", + "original_file_path": "models/features/kept_stg_billing_1.sql", + "unique_id": "model.generated_3.kept_stg_billing_1", + "fqn": [ + "generated_3", + "models", + "features", + "kept_stg_billing_1" + ], + "alias": "kept_stg_billing_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Statuses kept from stg_billing_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.kept_stg_billing_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.stg_billing_1" + ] + } + }, + "model.generated_3.audited_event_totals": { + "database": null, + "schema": "main", + "name": "audited_event_totals", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/rendering/audited_event_totals.sql", + "original_file_path": "models/rendering/audited_event_totals.sql", + "unique_id": "model.generated_3.audited_event_totals", + "fqn": [ + "generated_3", + "models", + "rendering", + "audited_event_totals" + ], + "alias": "audited_event_totals", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Totals of the audited events per channel", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.audited_event_totals", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_3.audited_events", + "seed.generated_3.channel_codes" + ] + } + }, + "model.generated_3.configured_stg_billing_1": { + "database": null, + "schema": "main", + "name": "configured_stg_billing_1", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/rendering/configured_stg_billing_1.sql", + "original_file_path": "models/rendering/configured_stg_billing_1.sql", + "unique_id": "model.generated_3.configured_stg_billing_1", + "fqn": [ + "generated_3", + "models", + "rendering", + "configured_stg_billing_1" + ], + "alias": "configured_stg_billing_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "development" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "development" + ], + "description": "Configured copy of stg_billing_1 (réglé)", + "columns": { + "id": { + "name": "id", + "description": "Row key", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "Montant réglé", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.configured_stg_billing_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.stg_billing_1" + ] + } + }, + "model.generated_3.interpolated_stg_billing_0": { + "database": null, + "schema": "main", + "name": "interpolated_stg_billing_0", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/rendering/interpolated_stg_billing_0.sql", + "original_file_path": "models/rendering/interpolated_stg_billing_0.sql", + "unique_id": "model.generated_3.interpolated_stg_billing_0", + "fqn": [ + "generated_3", + "models", + "rendering", + "interpolated_stg_billing_0" + ], + "alias": "interpolated_stg_billing_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'main.interpolated_stg_billing_0' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'refreshed ' || 'main.interpolated_stg_billing_0' AS note", + "transaction": true, + "index": 1 + }, + { + "sql": "SELECT 'dev' AS target, 'interpolated_stg_billing_0' AS model", + "transaction": true, + "index": 2 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Interpolated copy of stg_billing_0", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'main.interpolated_stg_billing_0' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "name": "announce_refresh", + "relative_path": "models/rendering/_sqlbuild/_hooks/sql/announce_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "Ελληνικά orders" + }, + "description": "Announce one refreshed relation" + }, + { + "type": "sql", + "statement": "SELECT 'refreshed ' || 'main.interpolated_stg_billing_0' AS note" + }, + { + "type": "sql", + "statement": "SELECT 'dev' AS target, 'interpolated_stg_billing_0' AS model" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.interpolated_stg_billing_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.stg_billing_0" + ] + } + }, + "model.generated_3.legacy_event_ids": { + "database": null, + "schema": "main", + "name": "legacy_event_ids", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/rendering/legacy_event_ids.sql", + "original_file_path": "models/rendering/legacy_event_ids.sql", + "unique_id": "model.generated_3.legacy_event_ids", + "fqn": [ + "generated_3", + "models", + "rendering", + "legacy_event_ids" + ], + "alias": "legacy_event_ids", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Ids read through a macro-generated reference", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.legacy_event_ids", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.stg_billing_1" + ] + } + }, + "model.generated_3.policy_stg_billing_1": { + "database": null, + "schema": "main", + "name": "policy_stg_billing_1", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/rendering/policy_stg_billing_1.sql", + "original_file_path": "models/rendering/policy_stg_billing_1.sql", + "unique_id": "model.generated_3.policy_stg_billing_1", + "fqn": [ + "generated_3", + "models", + "rendering", + "policy_stg_billing_1" + ], + "alias": "policy_stg_billing_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Policy-filtered copy of stg_billing_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.policy_stg_billing_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.stg_billing_1" + ] + } + }, + "model.generated_3.windowed_stg_billing_0": { + "database": null, + "schema": "main", + "name": "windowed_stg_billing_0", + "resource_type": "model", + "package_name": "generated_3", + "path": "models/rendering/windowed_stg_billing_0.sql", + "original_file_path": "models/rendering/windowed_stg_billing_0.sql", + "unique_id": "model.generated_3.windowed_stg_billing_0", + "fqn": [ + "generated_3", + "models", + "rendering", + "windowed_stg_billing_0" + ], + "alias": "windowed_stg_billing_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "windowed_copy", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Runtime-windowed copy of stg_billing_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.windowed_stg_billing_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_3.stg_billing_0" + ] + } + }, + "seed.generated_3.channel_codes": { + "database": null, + "schema": "main", + "name": "channel_codes", + "resource_type": "seed", + "package_name": "generated_3", + "path": "seeds/channel_codes.csv", + "original_file_path": "seeds/channel_codes.csv", + "unique_id": "seed.generated_3.channel_codes", + "fqn": [ + "generated_3", + "seeds", + "channel_codes" + ], + "alias": "channel_codes", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "seed", + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + }, + "delimiter": ",", + "quote_columns": null + }, + "tags": [], + "description": "Channel codes with seed audits.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.channel_codes", + "root_path": null, + "depends_on": { + "macros": [] + } + } + }, + "sources": { + "source.generated_3.audited_events": { + "database": null, + "schema": "", + "name": "audited_events", + "resource_type": "source", + "package_name": "generated_3", + "path": "sources/audited.yml", + "original_file_path": "sources/audited.yml", + "unique_id": "source.generated_3.audited_events", + "fqn": [ + "generated_3", + "audited_events" + ], + "source_name": "audited_events", + "source_description": "", + "loader": "", + "identifier": "audited_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Events with source audits.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_3.configured_events": { + "database": null, + "schema": "", + "name": "configured_events", + "resource_type": "source", + "package_name": "generated_3", + "path": "sources/configured.yml", + "original_file_path": "sources/configured.yml", + "unique_id": "source.generated_3.configured_events", + "fqn": [ + "generated_3", + "configured_events" + ], + "source_name": "configured_events", + "source_description": "", + "loader": "", + "identifier": "configured_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Configured feed events", + "columns": { + "id": { + "name": "id", + "description": "Key id", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "owner": "orders team" + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_3.raw_events_0": { + "database": null, + "schema": "", + "name": "raw_events_0", + "resource_type": "source", + "package_name": "generated_3", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_3.raw_events_0", + "fqn": [ + "generated_3", + "raw_events_0" + ], + "source_name": "raw_events_0", + "source_description": "", + "loader": "", + "identifier": "raw_events_0", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_3.raw_events_1": { + "database": null, + "schema": "", + "name": "raw_events_1", + "resource_type": "source", + "package_name": "generated_3", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_3.raw_events_1", + "fqn": [ + "generated_3", + "raw_events_1" + ], + "source_name": "raw_events_1", + "source_description": "", + "loader": "", + "identifier": "raw_events_1", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 1.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_3.raw_events_2": { + "database": null, + "schema": "", + "name": "raw_events_2", + "resource_type": "source", + "package_name": "generated_3", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_3.raw_events_2", + "fqn": [ + "generated_3", + "raw_events_2" + ], + "source_name": "raw_events_2", + "source_description": "", + "loader": "", + "identifier": "raw_events_2", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 2.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.generated_3.analysis_region": { + "name": "analysis_region", + "resource_type": "macro", + "package_name": "generated_3", + "path": "models/analysis/_sqlbuild/_macros/regions.py", + "original_file_path": "models/analysis/_sqlbuild/_macros/regions.py", + "unique_id": "macro.generated_3.analysis_region", + "macro_sql": "def analysis_region() -> str:\n \"\"\"Return the region rows are assigned to.\"\"\"\n return \"'east'\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/analysis" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_3.adjust_0": { + "name": "adjust_0", + "resource_type": "macro", + "package_name": "generated_3", + "path": "models/billing/marts/_sqlbuild/_macros/adjust_0.py", + "original_file_path": "models/billing/marts/_sqlbuild/_macros/adjust_0.py", + "unique_id": "macro.generated_3.adjust_0", + "macro_sql": "def adjust_0(expression: str) -> str:\n \"\"\"Offset an amount.\"\"\"\n return f\"({expression} + 0 + 1)\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/billing/marts" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_3.adjust_1": { + "name": "adjust_1", + "resource_type": "macro", + "package_name": "generated_3", + "path": "models/billing/staging/_sqlbuild/_macros/adjust_1.py", + "original_file_path": "models/billing/staging/_sqlbuild/_macros/adjust_1.py", + "unique_id": "macro.generated_3.adjust_1", + "macro_sql": "def adjust_1(ctx, expression: str) -> str:\n \"\"\"Scale an amount by the configured discount.\"\"\"\n rate = ctx.vars[\"discount_rate\"]\n return f\"({expression} * (1 - {rate}))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/billing/staging" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_3.legacy_events": { + "name": "legacy_events", + "resource_type": "macro", + "package_name": "generated_3", + "path": "models/rendering/_sqlbuild/_macros/legacy.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/legacy.py", + "unique_id": "macro.generated_3.legacy_events", + "macro_sql": "def legacy_events() -> str:\n \"\"\"Return a staged relation the way a migrated project wrote it.\"\"\"\n return '__ref(\"stg_billing_1\")'\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_3.refresh_note": { + "name": "refresh_note", + "resource_type": "macro", + "package_name": "generated_3", + "path": "models/rendering/_sqlbuild/_macros/notes.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/notes.py", + "unique_id": "macro.generated_3.refresh_note", + "macro_sql": "def refresh_note(relation: str) -> str:\n \"\"\"Describe one refreshed relation.\"\"\"\n return f\"'refreshed ' || '{relation}'\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_3.channel_label": { + "name": "channel_label", + "resource_type": "macro", + "package_name": "generated_3", + "path": "models/rendering/_sqlbuild/_macros/policy.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/policy.py", + "unique_id": "macro.generated_3.channel_label", + "macro_sql": "import os\n\n\ndef minimum_amount_filter(ctx, column: str) -> str:\n \"\"\"Keep rows at or above the configured minimum amount.\"\"\"\n if ctx.constants[\"minimum_render_amount\"] is None:\n return \"TRUE\"\n return f\"{column} >= {ctx.render_constant('minimum_render_amount')}\"\n\n\ndef channel_label(ctx) -> str:\n \"\"\"Label rows with the web channel, target and adapter.\"\"\"\n channel = ctx.render_enum_member(enum_name=\"render_channel\", member_name=\"WEB\")\n region = ctx.vars[\"region\"]\n return f\"{channel} || '/{ctx.target_name}/{ctx.adapter_name}/{region}'\"\n\n\ndef with_deployment(expression: str) -> str:\n \"\"\"Suffix an expression with the deployment channel from the environment.\"\"\"\n channel = os.environ.get(\"SQB_DIFFERENTIAL_CHANNEL\", \"none\")\n return f\"({expression} || '@{channel}')\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_3.minimum_amount_filter": { + "name": "minimum_amount_filter", + "resource_type": "macro", + "package_name": "generated_3", + "path": "models/rendering/_sqlbuild/_macros/policy.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/policy.py", + "unique_id": "macro.generated_3.minimum_amount_filter", + "macro_sql": "import os\n\n\ndef minimum_amount_filter(ctx, column: str) -> str:\n \"\"\"Keep rows at or above the configured minimum amount.\"\"\"\n if ctx.constants[\"minimum_render_amount\"] is None:\n return \"TRUE\"\n return f\"{column} >= {ctx.render_constant('minimum_render_amount')}\"\n\n\ndef channel_label(ctx) -> str:\n \"\"\"Label rows with the web channel, target and adapter.\"\"\"\n channel = ctx.render_enum_member(enum_name=\"render_channel\", member_name=\"WEB\")\n region = ctx.vars[\"region\"]\n return f\"{channel} || '/{ctx.target_name}/{ctx.adapter_name}/{region}'\"\n\n\ndef with_deployment(expression: str) -> str:\n \"\"\"Suffix an expression with the deployment channel from the environment.\"\"\"\n channel = os.environ.get(\"SQB_DIFFERENTIAL_CHANNEL\", \"none\")\n return f\"({expression} || '@{channel}')\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_3.with_deployment": { + "name": "with_deployment", + "resource_type": "macro", + "package_name": "generated_3", + "path": "models/rendering/_sqlbuild/_macros/policy.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/policy.py", + "unique_id": "macro.generated_3.with_deployment", + "macro_sql": "import os\n\n\ndef minimum_amount_filter(ctx, column: str) -> str:\n \"\"\"Keep rows at or above the configured minimum amount.\"\"\"\n if ctx.constants[\"minimum_render_amount\"] is None:\n return \"TRUE\"\n return f\"{column} >= {ctx.render_constant('minimum_render_amount')}\"\n\n\ndef channel_label(ctx) -> str:\n \"\"\"Label rows with the web channel, target and adapter.\"\"\"\n channel = ctx.render_enum_member(enum_name=\"render_channel\", member_name=\"WEB\")\n region = ctx.vars[\"region\"]\n return f\"{channel} || '/{ctx.target_name}/{ctx.adapter_name}/{region}'\"\n\n\ndef with_deployment(expression: str) -> str:\n \"\"\"Suffix an expression with the deployment channel from the environment.\"\"\"\n channel = os.environ.get(\"SQB_DIFFERENTIAL_CHANNEL\", \"none\")\n return f\"({expression} || '@{channel}')\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_3.doubled": { + "name": "doubled", + "resource_type": "macro", + "package_name": "generated_3", + "path": "tests/unit/_macros/scaling.py", + "original_file_path": "tests/unit/_macros/scaling.py", + "unique_id": "macro.generated_3.doubled", + "macro_sql": "def doubled(expression: str) -> str:\n \"\"\"Double an amount.\"\"\"\n return f\"({expression} * 2)\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "tests/unit" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_3__sqlbuild_hooks.record_refresh": { + "name": "record_refresh", + "resource_type": "macro", + "package_name": "generated_3__sqlbuild_hooks", + "path": "models/billing/marts/_sqlbuild/_hooks/sql/record_refresh.sql", + "original_file_path": "models/billing/marts/_sqlbuild/_hooks/sql/record_refresh.sql", + "unique_id": "macro.generated_3__sqlbuild_hooks.record_refresh", + "macro_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "depends_on": { + "macros": [] + }, + "description": "Record a refresh for one relation", + "meta": { + "sqlbuild_resource_type": "sql_hook", + "sqlbuild_hook_name": "record_refresh" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_3__sqlbuild_hooks.announce_refresh": { + "name": "announce_refresh", + "resource_type": "macro", + "package_name": "generated_3__sqlbuild_hooks", + "path": "models/rendering/_sqlbuild/_hooks/sql/announce_refresh.sql", + "original_file_path": "models/rendering/_sqlbuild/_hooks/sql/announce_refresh.sql", + "unique_id": "macro.generated_3__sqlbuild_hooks.announce_refresh", + "macro_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "depends_on": { + "macros": [] + }, + "description": "Announce one refreshed relation", + "meta": { + "sqlbuild_resource_type": "sql_hook", + "sqlbuild_hook_name": "announce_refresh" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.generated_3.banded_amounts": [ + "model.generated_3.table_fn__amount_bands" + ], + "model.generated_3.checked_stg_billing_1": [ + "model.generated_3.stg_billing_1" + ], + "model.generated_3.regional_stg_billing_1": [ + "model.generated_3.stg_billing_1" + ], + "model.generated_3.scaled_stg_billing_1": [ + "model.generated_3.scaled_amount", + "model.generated_3.stg_billing_1" + ], + "model.generated_3.billing_summary_0": [ + "model.generated_3.stg_billing_1", + "model.generated_3.stg_billing_0" + ], + "model.generated_3.billing_summary_1": [ + "model.generated_3.stg_billing_1" + ], + "model.generated_3.stg_billing_0": [ + "source.generated_3.raw_events_2" + ], + "model.generated_3.stg_billing_1": [ + "source.generated_3.raw_events_2" + ], + "model.generated_3.batched_watermark_stg_billing_1": [ + "model.generated_3.stg_billing_1" + ], + "model.generated_3.hooked_stg_billing_1": [ + "model.generated_3.stg_billing_1" + ], + "model.generated_3.kept_stg_billing_1": [ + "model.generated_3.stg_billing_1" + ], + "model.generated_3.audited_event_totals": [ + "source.generated_3.audited_events", + "seed.generated_3.channel_codes" + ], + "model.generated_3.configured_stg_billing_1": [ + "model.generated_3.stg_billing_1" + ], + "model.generated_3.interpolated_stg_billing_0": [ + "model.generated_3.stg_billing_0" + ], + "model.generated_3.legacy_event_ids": [ + "model.generated_3.stg_billing_1" + ], + "model.generated_3.policy_stg_billing_1": [ + "model.generated_3.stg_billing_1" + ], + "model.generated_3.windowed_stg_billing_0": [ + "model.generated_3.stg_billing_0" + ], + "source.generated_3.audited_events": [], + "source.generated_3.configured_events": [], + "source.generated_3.raw_events_0": [], + "source.generated_3.raw_events_1": [], + "source.generated_3.raw_events_2": [], + "seed.generated_3.channel_codes": [], + "model.generated_3.configured_label": [], + "model.generated_3.scaled_amount": [], + "model.generated_3.table_fn__amount_bands": [ + "model.generated_3.stg_billing_1" + ] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/seed/4.json b/tests/goldens/compiler/seed/4.json new file mode 100644 index 0000000000..c97add18f8 --- /dev/null +++ b/tests/goldens/compiler/seed/4.json @@ -0,0 +1,3131 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-store-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "audits/generic/configured_events/accepted_values__id.sql": [ + "SELECT id", + "FROM __source(\"configured_events\")", + "WHERE id IS NOT NULL", + " AND id NOT IN ('1')", + "" + ], + "audits/generic/configured_stg_support_0/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"configured_stg_support_0\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'shipped')", + "" + ], + "audits/generic/configured_stg_support_0/configured_amount_floor.sql": [ + "SELECT *", + "FROM __ref(\"configured_stg_support_0\")", + "WHERE amount < -30", + "" + ], + "audits/generic/configured_stg_support_0/configured_id_present__id.sql": [ + "SELECT id", + "FROM __ref(\"configured_stg_support_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/configured_stg_support_0/unique__id.sql": [ + "SELECT id, COUNT(*) AS duplicate_count", + "FROM __ref(\"configured_stg_support_0\")", + "WHERE id IS NOT NULL", + "GROUP BY id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/guarded_stg_support_0/amount_at_least__amount.sql": [ + "SELECT *", + "FROM __ref(\"guarded_stg_support_0\")", + "WHERE amount < 0", + "" + ], + "audits/generic/shaped_stg_support_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"shaped_stg_support_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_support_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_support_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/support_summary_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"support_summary_0\")", + "WHERE id IS NULL", + "" + ], + "audits/singular/support_summary_1_matches.sql": [ + "SELECT a.id", + "FROM __ref(\"support_summary_1\") a", + "LEFT JOIN __ref(\"support_summary_0\") b ON a.id = b.id", + "WHERE b.id IS NULL", + "" + ], + "functions/sql/configured_label.sql": [ + "CREATE OR REPLACE MACRO ci_checks.configured_label(raw_status) AS (", + "UPPER(raw_status)", + ")", + "" + ], + "models/analysis/combined_stg_support_0.sql": [ + "WITH recent AS (", + " SELECT id, created_at FROM __ref(\"stg_support_0\") WHERE amount > 0", + "),", + "older AS (", + " SELECT id, created_at FROM __ref(\"stg_support_0\")", + ")", + "SELECT id, created_at FROM recent", + "UNION ALL", + "SELECT id, created_at FROM older", + "" + ], + "models/analysis/every_open_event.sql": [ + "SELECT *", + "FROM __source(\"open_events\")", + "" + ], + "models/analysis/every_raw_events_0.sql": [ + "SELECT *", + "FROM __source(\"raw_events_0\")", + "" + ], + "models/analysis/every_stg_support_0.sql": [ + "SELECT *", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/analysis/passed_stg_support_0.sql": [ + "WITH passthrough AS (", + " SELECT id, created_at FROM __ref(\"stg_support_0\")", + ")", + "SELECT id, created_at", + "FROM passthrough", + "" + ], + "models/analysis/pivot_input_stg_support_0.sql": [ + "SELECT CAST(id AS INTEGER) AS id, CAST(status AS VARCHAR) AS status, amount", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/analysis/pivoted_stg_support_0.sql": [ + "PIVOT __ref(\"pivot_input_stg_support_0\")", + "ON status", + "USING MAX(amount)", + "GROUP BY id", + "" + ], + "models/analysis/quoted_stg_support_0.sql": [ + "SELECT \"ID\" AS \"OrderKey\", \"Amount\", \"Status\" AS \"Status\"", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/analysis/regional_stg_support_0.sql": [ + "SELECT id, amount, 'north' AS region", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/analysis/typed_stg_support_0.sql": [ + "SELECT id, amount * 2 AS doubled_amount, CAST(status AS VARCHAR) AS status_text,", + " created_at, NULL AS missing_note", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/analysis/unanalysed_stg_support_0.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_support_0\")", + "WHERE id = ANY [1, 2]", + "" + ], + "models/features/append_stg_support_0.sql": [ + "SELECT id, amount, status, created_at", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/features/batched_rolling_window_stg_support_0.sql": [ + "SELECT CAST(created_at AS DATE) AS created_at, SUM(amount) AS amount", + "FROM __ref(\"stg_support_0\")", + "GROUP BY CAST(created_at AS DATE)", + "" + ], + "models/features/guarded_stg_support_0.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/features/product_labels.sql": [ + "SELECT id, label", + "FROM __source(\"loaded_products\")", + "" + ], + "models/features/shaped_stg_support_0.sql": [ + "SELECT CAST(id AS INTEGER) AS id, status", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/features/timestamp_history_stg_support_0.sql": [ + "SELECT id, status, created_at", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/rendering/bounded_stg_support_0.sql": [ + "SELECT id, amount, created_at", + "FROM __ref(\"stg_support_0\")", + "WHERE created_at >= __cursor_start()", + " AND created_at < __cursor_end()", + "" + ], + "models/rendering/configured_stg_support_0.sql": [ + "SELECT id, amount, status", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/rendering/latest_raw_events_0.sql": [ + "SELECT id, amount", + "FROM (SELECT id, amount FROM __source(\"raw_events_0\") ORDER BY id DESC LIMIT 2) AS latest", + "" + ], + "models/rendering/policy_stg_support_0.sql": [ + "SELECT id, amount, ('web' || '/ci/generated_duckdb/west' || '@web-orders') AS channel,", + " 1 AS minimum_amount,", + " 'store' AS fallback_channel", + "FROM __ref(\"stg_support_0\")", + "WHERE amount >= 1", + "" + ], + "models/rendering/unioned_event_ids.sql": [ + "SELECT id", + "FROM (SELECT id FROM __ref(\"stg_support_0\") UNION ALL SELECT id FROM __ref(\"stg_support_0\")) AS unioned", + "" + ], + "models/support/marts/support_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_1_amount,", + " j1.label AS lookup_label_1", + "FROM __ref(\"stg_support_0\") t", + "LEFT JOIN __seed(\"lookup_1\") j1 ON t.id = j1.id", + "" + ], + "models/support/marts/support_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * 2.4700 AS threshold_0_amount,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_0_amount,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_1_amount,", + " j1.label AS lookup_label_1,", + " '東京 warehouse' AS site_label", + "FROM __ref(\"stg_support_0\") t", + "LEFT JOIN __seed(\"lookup_0\") j1 ON t.id = j1.id", + "WHERE t.status <> 'returned ✓'", + "" + ], + "models/support/marts/support_summary_2.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_1_amount,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_2_amount,", + " j1.label AS lookup_label_1,", + " '東京 warehouse' AS site_label", + "FROM __ref(\"stg_support_0\") t", + "LEFT JOIN __seed(\"lookup_1\") j1 ON t.id = j1.id", + "" + ], + "models/support/staging/stg_support_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * 2.4700 AS threshold_0_amount,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_2_amount", + "FROM __source(\"raw_events_0\") t", + "" + ], + "tests/regional_stg_support_0/test_regional_stg_support_0.sql": [ + "WITH __ref__stg_support_0 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__regional_stg_support_0 AS (SELECT id, amount, 'west' AS region", + "FROM __ref__stg_support_0),", + "__actual__regional_stg_support_0 AS (SELECT * FROM __ref__regional_stg_support_0),", + "__expected__regional_stg_support_0 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'west' AS region)", + "SELECT 0 AS step_index, 'regional_stg_support_0' AS model_name, (SELECT COUNT(*) FROM __actual__regional_stg_support_0) AS actual_count, (SELECT COUNT(*) FROM __expected__regional_stg_support_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __actual__regional_stg_support_0 EXCEPT SELECT id, amount, region FROM __expected__regional_stg_support_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __expected__regional_stg_support_0 EXCEPT SELECT id, amount, region FROM __actual__regional_stg_support_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/stg_support_0/test_stg_support_0.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(10 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_support_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * 2.4700 AS threshold_0_amount,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_2_amount", + "FROM __source__raw_events_0 t),", + "__actual__stg_support_0 AS (SELECT * FROM __ref__stg_support_0),", + "__expected__stg_support_0 AS (SELECT 1 AS id, 'placed' AS status)", + "SELECT 0 AS step_index, 'stg_support_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_support_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_support_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __actual__stg_support_0 EXCEPT SELECT id, status FROM __expected__stg_support_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __expected__stg_support_0 EXCEPT SELECT id, status FROM __actual__stg_support_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/tests/unit/test_stg_support_0_cases/block_1__labelled.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(2.25 AS DOUBLE) AS amount,", + " '東京 warehouse' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_support_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * 2.4700 AS threshold_0_amount,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_2_amount", + "FROM __source__raw_events_0 t),", + "__actual__stg_support_0 AS (SELECT * FROM __ref__stg_support_0),", + "__expected__stg_support_0 AS (SELECT 1 AS id)", + "SELECT 0 AS step_index, 'stg_support_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_support_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_support_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id FROM __actual__stg_support_0 EXCEPT SELECT id FROM __expected__stg_support_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id FROM __expected__stg_support_0 EXCEPT SELECT id FROM __actual__stg_support_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/tests/unit/test_stg_support_0_cases/block_1__placed.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(1.5 AS DOUBLE) AS amount,", + " 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_support_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * 2.4700 AS threshold_0_amount,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_2_amount", + "FROM __source__raw_events_0 t),", + "__actual__stg_support_0 AS (SELECT * FROM __ref__stg_support_0),", + "__expected__stg_support_0 AS (SELECT 1 AS id)", + "SELECT 0 AS step_index, 'stg_support_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_support_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_support_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id FROM __actual__stg_support_0 EXCEPT SELECT id FROM __expected__stg_support_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id FROM __expected__stg_support_0 EXCEPT SELECT id FROM __actual__stg_support_0) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.generated_4.combined_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "combined_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/analysis/combined_stg_support_0.sql", + "original_file_path": "models/analysis/combined_stg_support_0.sql", + "unique_id": "model.generated_4.combined_stg_support_0", + "fqn": [ + "generated_4", + "models", + "analysis", + "combined_stg_support_0" + ], + "alias": "combined_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Recent and older rows of stg_support_0 and stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.combined_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.every_open_event": { + "database": null, + "schema": "ci_checks", + "name": "every_open_event", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/analysis/every_open_event.sql", + "original_file_path": "models/analysis/every_open_event.sql", + "unique_id": "model.generated_4.every_open_event", + "fqn": [ + "generated_4", + "models", + "analysis", + "every_open_event" + ], + "alias": "every_open_event", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Every column of an open source", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.every_open_event", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_4.open_events" + ] + } + }, + "model.generated_4.every_raw_events_0": { + "database": null, + "schema": "ci_checks", + "name": "every_raw_events_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/analysis/every_raw_events_0.sql", + "original_file_path": "models/analysis/every_raw_events_0.sql", + "unique_id": "model.generated_4.every_raw_events_0", + "fqn": [ + "generated_4", + "models", + "analysis", + "every_raw_events_0" + ], + "alias": "every_raw_events_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Every column of raw_events_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.every_raw_events_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_4.raw_events_0" + ] + } + }, + "model.generated_4.every_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "every_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/analysis/every_stg_support_0.sql", + "original_file_path": "models/analysis/every_stg_support_0.sql", + "unique_id": "model.generated_4.every_stg_support_0", + "fqn": [ + "generated_4", + "models", + "analysis", + "every_stg_support_0" + ], + "alias": "every_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Every column of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.every_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.passed_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "passed_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/analysis/passed_stg_support_0.sql", + "original_file_path": "models/analysis/passed_stg_support_0.sql", + "unique_id": "model.generated_4.passed_stg_support_0", + "fqn": [ + "generated_4", + "models", + "analysis", + "passed_stg_support_0" + ], + "alias": "passed_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Columns of stg_support_0 passed through a CTE", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.passed_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.pivot_input_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "pivot_input_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/analysis/pivot_input_stg_support_0.sql", + "original_file_path": "models/analysis/pivot_input_stg_support_0.sql", + "unique_id": "model.generated_4.pivot_input_stg_support_0", + "fqn": [ + "generated_4", + "models", + "analysis", + "pivot_input_stg_support_0" + ], + "alias": "pivot_input_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Contracted pivot input from stg_support_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.pivot_input_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.pivoted_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "pivoted_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/analysis/pivoted_stg_support_0.sql", + "original_file_path": "models/analysis/pivoted_stg_support_0.sql", + "unique_id": "model.generated_4.pivoted_stg_support_0", + "fqn": [ + "generated_4", + "models", + "analysis", + "pivoted_stg_support_0" + ], + "alias": "pivoted_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Amounts of stg_support_0 pivoted by status", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "dynamic_columns": [ + { + "name": "status_amounts", + "pivot_column": "status", + "value_column": "amount", + "aggregate": "MAX", + "type": "DOUBLE", + "name_pattern": null + } + ] + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.pivoted_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.pivot_input_stg_support_0" + ] + } + }, + "model.generated_4.quoted_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "quoted_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/analysis/quoted_stg_support_0.sql", + "original_file_path": "models/analysis/quoted_stg_support_0.sql", + "unique_id": "model.generated_4.quoted_stg_support_0", + "fqn": [ + "generated_4", + "models", + "analysis", + "quoted_stg_support_0" + ], + "alias": "quoted_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Quoted identifiers over stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.quoted_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.regional_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "regional_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/analysis/regional_stg_support_0.sql", + "original_file_path": "models/analysis/regional_stg_support_0.sql", + "unique_id": "model.generated_4.regional_stg_support_0", + "fqn": [ + "generated_4", + "models", + "analysis", + "regional_stg_support_0" + ], + "alias": "regional_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Regional copy of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.regional_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.typed_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "typed_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/analysis/typed_stg_support_0.sql", + "original_file_path": "models/analysis/typed_stg_support_0.sql", + "unique_id": "model.generated_4.typed_stg_support_0", + "fqn": [ + "generated_4", + "models", + "analysis", + "typed_stg_support_0" + ], + "alias": "typed_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Typed and untyped outputs of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.typed_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.unanalysed_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "unanalysed_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/analysis/unanalysed_stg_support_0.sql", + "original_file_path": "models/analysis/unanalysed_stg_support_0.sql", + "unique_id": "model.generated_4.unanalysed_stg_support_0", + "fqn": [ + "generated_4", + "models", + "analysis", + "unanalysed_stg_support_0" + ], + "alias": "unanalysed_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Copy of stg_support_0 that SQL analysis cannot parse", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.unanalysed_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.append_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "append_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/features/append_stg_support_0.sql", + "original_file_path": "models/features/append_stg_support_0.sql", + "unique_id": "model.generated_4.append_stg_support_0", + "fqn": [ + "generated_4", + "models", + "features", + "append_stg_support_0" + ], + "alias": "append_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "append", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Incremental append copy of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.append_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.batched_rolling_window_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "batched_rolling_window_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/features/batched_rolling_window_stg_support_0.sql", + "original_file_path": "models/features/batched_rolling_window_stg_support_0.sql", + "unique_id": "model.generated_4.batched_rolling_window_stg_support_0", + "fqn": [ + "generated_4", + "models", + "features", + "batched_rolling_window_stg_support_0" + ], + "alias": "batched_rolling_window_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Microbatched rolling_window totals of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.batched_rolling_window_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.guarded_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "guarded_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/features/guarded_stg_support_0.sql", + "original_file_path": "models/features/guarded_stg_support_0.sql", + "unique_id": "model.generated_4.guarded_stg_support_0", + "fqn": [ + "generated_4", + "models", + "features", + "guarded_stg_support_0" + ], + "alias": "guarded_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Generic-audited copy of stg_support_0", + "columns": { + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.guarded_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.product_labels": { + "database": null, + "schema": "ci_checks", + "name": "product_labels", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/features/product_labels.sql", + "original_file_path": "models/features/product_labels.sql", + "unique_id": "model.generated_4.product_labels", + "fqn": [ + "generated_4", + "models", + "features", + "product_labels" + ], + "alias": "product_labels", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Product labels from the loader", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.product_labels", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_4.loaded_products" + ] + } + }, + "model.generated_4.shaped_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "shaped_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/features/shaped_stg_support_0.sql", + "original_file_path": "models/features/shaped_stg_support_0.sql", + "unique_id": "model.generated_4.shaped_stg_support_0", + "fqn": [ + "generated_4", + "models", + "features", + "shaped_stg_support_0" + ], + "alias": "shaped_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Schema-shaped copy of stg_support_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.shaped_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.timestamp_history_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "timestamp_history_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/features/timestamp_history_stg_support_0.sql", + "original_file_path": "models/features/timestamp_history_stg_support_0.sql", + "unique_id": "model.generated_4.timestamp_history_stg_support_0", + "fqn": [ + "generated_4", + "models", + "features", + "timestamp_history_stg_support_0" + ], + "alias": "timestamp_history_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "snapshot", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Timestamp history of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.timestamp_history_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.bounded_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "bounded_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/rendering/bounded_stg_support_0.sql", + "original_file_path": "models/rendering/bounded_stg_support_0.sql", + "unique_id": "model.generated_4.bounded_stg_support_0", + "fqn": [ + "generated_4", + "models", + "rendering", + "bounded_stg_support_0" + ], + "alias": "bounded_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Cursor-bounded copy of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.bounded_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.configured_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "configured_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/rendering/configured_stg_support_0.sql", + "original_file_path": "models/rendering/configured_stg_support_0.sql", + "unique_id": "model.generated_4.configured_stg_support_0", + "fqn": [ + "generated_4", + "models", + "rendering", + "configured_stg_support_0" + ], + "alias": "configured_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "release" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "release" + ], + "description": "Configured copy of stg_support_0 (réglé)", + "columns": { + "id": { + "name": "id", + "description": "Row key", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "Montant réglé", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.configured_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.latest_raw_events_0": { + "database": null, + "schema": "ci_checks", + "name": "latest_raw_events_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/rendering/latest_raw_events_0.sql", + "original_file_path": "models/rendering/latest_raw_events_0.sql", + "unique_id": "model.generated_4.latest_raw_events_0", + "fqn": [ + "generated_4", + "models", + "rendering", + "latest_raw_events_0" + ], + "alias": "latest_raw_events_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Newest rows of raw_events_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.latest_raw_events_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_4.raw_events_0" + ] + } + }, + "model.generated_4.policy_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "policy_stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/rendering/policy_stg_support_0.sql", + "original_file_path": "models/rendering/policy_stg_support_0.sql", + "unique_id": "model.generated_4.policy_stg_support_0", + "fqn": [ + "generated_4", + "models", + "rendering", + "policy_stg_support_0" + ], + "alias": "policy_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Policy-filtered copy of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.policy_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.unioned_event_ids": { + "database": null, + "schema": "ci_checks", + "name": "unioned_event_ids", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/rendering/unioned_event_ids.sql", + "original_file_path": "models/rendering/unioned_event_ids.sql", + "unique_id": "model.generated_4.unioned_event_ids", + "fqn": [ + "generated_4", + "models", + "rendering", + "unioned_event_ids" + ], + "alias": "unioned_event_ids", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Ids from two staged relations", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.unioned_event_ids", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0" + ] + } + }, + "model.generated_4.support_summary_0": { + "database": null, + "schema": "ci_checks", + "name": "support_summary_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/support/marts/support_summary_0.sql", + "original_file_path": "models/support/marts/support_summary_0.sql", + "unique_id": "model.generated_4.support_summary_0", + "fqn": [ + "generated_4", + "models", + "support", + "marts", + "support_summary_0" + ], + "alias": "support_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "support", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'ci_checks.support_summary_0' AS refreshed_relation, 'naïve résumé' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'ci_checks.support_summary_0' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "support", + "marts" + ], + "description": "Summary of support activity 0 (東京 warehouse)", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'ci_checks.support_summary_0' AS refreshed_relation, 'naïve résumé' AS refresh_label", + "name": "record_refresh", + "relative_path": "models/support/marts/_sqlbuild/_hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "naïve résumé" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'ci_checks.support_summary_0' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.support_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0", + "seed.generated_4.lookup_1" + ] + } + }, + "model.generated_4.support_summary_1": { + "database": null, + "schema": "ci_checks", + "name": "support_summary_1", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/support/marts/support_summary_1.sql", + "original_file_path": "models/support/marts/support_summary_1.sql", + "unique_id": "model.generated_4.support_summary_1", + "fqn": [ + "generated_4", + "models", + "support", + "marts", + "support_summary_1" + ], + "alias": "support_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "support", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "support", + "marts" + ], + "description": "Summary of support activity 1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.support_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0", + "seed.generated_4.lookup_0" + ] + } + }, + "model.generated_4.support_summary_2": { + "database": null, + "schema": "ci_checks", + "name": "support_summary_2", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/support/marts/support_summary_2.sql", + "original_file_path": "models/support/marts/support_summary_2.sql", + "unique_id": "model.generated_4.support_summary_2", + "fqn": [ + "generated_4", + "models", + "support", + "marts", + "support_summary_2" + ], + "alias": "support_summary_2", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "support", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "support", + "marts" + ], + "description": "Summary of support activity 2 (café ☕ counter)", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.support_summary_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_4.stg_support_0", + "seed.generated_4.lookup_1" + ] + } + }, + "model.generated_4.stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "stg_support_0", + "resource_type": "model", + "package_name": "generated_4", + "path": "models/support/staging/stg_support_0.sql", + "original_file_path": "models/support/staging/stg_support_0.sql", + "unique_id": "model.generated_4.stg_support_0", + "fqn": [ + "generated_4", + "models", + "support", + "staging", + "stg_support_0" + ], + "alias": "stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged support events 0 (naïve résumé)", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_4.raw_events_0" + ] + } + }, + "seed.generated_4.lookup_0": { + "database": null, + "schema": "ci_checks", + "name": "lookup_0", + "resource_type": "seed", + "package_name": "generated_4", + "path": "seeds/lookup_0.csv", + "original_file_path": "seeds/lookup_0.csv", + "unique_id": "seed.generated_4.lookup_0", + "fqn": [ + "generated_4", + "seeds", + "lookup_0" + ], + "alias": "lookup_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "seed", + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + }, + "delimiter": ",", + "quote_columns": null + }, + "tags": [], + "description": "Generated lookup 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.lookup_0", + "root_path": null, + "depends_on": { + "macros": [] + } + }, + "seed.generated_4.lookup_1": { + "database": null, + "schema": "ci_checks", + "name": "lookup_1", + "resource_type": "seed", + "package_name": "generated_4", + "path": "seeds/lookup_1.csv", + "original_file_path": "seeds/lookup_1.csv", + "unique_id": "seed.generated_4.lookup_1", + "fqn": [ + "generated_4", + "seeds", + "lookup_1" + ], + "alias": "lookup_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "seed", + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + }, + "delimiter": ",", + "quote_columns": null + }, + "tags": [], + "description": "Generated lookup 1.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.lookup_1", + "root_path": null, + "depends_on": { + "macros": [] + } + } + }, + "sources": { + "source.generated_4.configured_events": { + "database": null, + "schema": "", + "name": "configured_events", + "resource_type": "source", + "package_name": "generated_4", + "path": "sources/configured.yml", + "original_file_path": "sources/configured.yml", + "unique_id": "source.generated_4.configured_events", + "fqn": [ + "generated_4", + "configured_events" + ], + "source_name": "configured_events", + "source_description": "", + "loader": "", + "identifier": "configured_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Configured feed events", + "columns": { + "id": { + "name": "id", + "description": "Key id", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "owner": "orders team" + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_4.loaded_products": { + "database": null, + "schema": "ci_checks", + "name": "loaded_products", + "resource_type": "source", + "package_name": "generated_4", + "path": "sources/managed.yml", + "original_file_path": "sources/managed.yml", + "unique_id": "source.generated_4.loaded_products", + "fqn": [ + "generated_4", + "loaded_products" + ], + "source_name": "loaded_products", + "source_description": "", + "loader": "", + "identifier": "loaded_products", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Products loaded by a project loader.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "loaded_products", + "auto_load": false, + "write_strategy": "table" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_4.open_events": { + "database": null, + "schema": "", + "name": "open_events", + "resource_type": "source", + "package_name": "generated_4", + "path": "sources/open.yml", + "original_file_path": "sources/open.yml", + "unique_id": "source.generated_4.open_events", + "fqn": [ + "generated_4", + "open_events" + ], + "source_name": "open_events", + "source_description": "", + "loader": "", + "identifier": "open_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Events whose columns are only known to the warehouse.", + "columns": {}, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_4.raw_events_0": { + "database": null, + "schema": "", + "name": "raw_events_0", + "resource_type": "source", + "package_name": "generated_4", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_4.raw_events_0", + "fqn": [ + "generated_4", + "raw_events_0" + ], + "source_name": "raw_events_0", + "source_description": "", + "loader": "", + "identifier": "raw_events_0", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.generated_4.analysis_region": { + "name": "analysis_region", + "resource_type": "macro", + "package_name": "generated_4", + "path": "models/analysis/_sqlbuild/_macros/regions.py", + "original_file_path": "models/analysis/_sqlbuild/_macros/regions.py", + "unique_id": "macro.generated_4.analysis_region", + "macro_sql": "def analysis_region() -> str:\n \"\"\"Return the region rows are assigned to.\"\"\"\n return \"'north'\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/analysis" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_4.channel_label": { + "name": "channel_label", + "resource_type": "macro", + "package_name": "generated_4", + "path": "models/rendering/_sqlbuild/_macros/policy.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/policy.py", + "unique_id": "macro.generated_4.channel_label", + "macro_sql": "import os\n\n\ndef minimum_amount_filter(ctx, column: str) -> str:\n \"\"\"Keep rows at or above the configured minimum amount.\"\"\"\n if ctx.constants[\"minimum_render_amount\"] is None:\n return \"TRUE\"\n return f\"{column} >= {ctx.render_constant('minimum_render_amount')}\"\n\n\ndef channel_label(ctx) -> str:\n \"\"\"Label rows with the web channel, target and adapter.\"\"\"\n channel = ctx.render_enum_member(enum_name=\"render_channel\", member_name=\"WEB\")\n region = ctx.vars[\"region\"]\n return f\"{channel} || '/{ctx.target_name}/{ctx.adapter_name}/{region}'\"\n\n\ndef with_deployment(expression: str) -> str:\n \"\"\"Suffix an expression with the deployment channel from the environment.\"\"\"\n channel = os.environ.get(\"SQB_DIFFERENTIAL_CHANNEL\", \"none\")\n return f\"({expression} || '@{channel}')\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_4.minimum_amount_filter": { + "name": "minimum_amount_filter", + "resource_type": "macro", + "package_name": "generated_4", + "path": "models/rendering/_sqlbuild/_macros/policy.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/policy.py", + "unique_id": "macro.generated_4.minimum_amount_filter", + "macro_sql": "import os\n\n\ndef minimum_amount_filter(ctx, column: str) -> str:\n \"\"\"Keep rows at or above the configured minimum amount.\"\"\"\n if ctx.constants[\"minimum_render_amount\"] is None:\n return \"TRUE\"\n return f\"{column} >= {ctx.render_constant('minimum_render_amount')}\"\n\n\ndef channel_label(ctx) -> str:\n \"\"\"Label rows with the web channel, target and adapter.\"\"\"\n channel = ctx.render_enum_member(enum_name=\"render_channel\", member_name=\"WEB\")\n region = ctx.vars[\"region\"]\n return f\"{channel} || '/{ctx.target_name}/{ctx.adapter_name}/{region}'\"\n\n\ndef with_deployment(expression: str) -> str:\n \"\"\"Suffix an expression with the deployment channel from the environment.\"\"\"\n channel = os.environ.get(\"SQB_DIFFERENTIAL_CHANNEL\", \"none\")\n return f\"({expression} || '@{channel}')\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_4.with_deployment": { + "name": "with_deployment", + "resource_type": "macro", + "package_name": "generated_4", + "path": "models/rendering/_sqlbuild/_macros/policy.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/policy.py", + "unique_id": "macro.generated_4.with_deployment", + "macro_sql": "import os\n\n\ndef minimum_amount_filter(ctx, column: str) -> str:\n \"\"\"Keep rows at or above the configured minimum amount.\"\"\"\n if ctx.constants[\"minimum_render_amount\"] is None:\n return \"TRUE\"\n return f\"{column} >= {ctx.render_constant('minimum_render_amount')}\"\n\n\ndef channel_label(ctx) -> str:\n \"\"\"Label rows with the web channel, target and adapter.\"\"\"\n channel = ctx.render_enum_member(enum_name=\"render_channel\", member_name=\"WEB\")\n region = ctx.vars[\"region\"]\n return f\"{channel} || '/{ctx.target_name}/{ctx.adapter_name}/{region}'\"\n\n\ndef with_deployment(expression: str) -> str:\n \"\"\"Suffix an expression with the deployment channel from the environment.\"\"\"\n channel = os.environ.get(\"SQB_DIFFERENTIAL_CHANNEL\", \"none\")\n return f\"({expression} || '@{channel}')\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_4.latest_rows": { + "name": "latest_rows", + "resource_type": "macro", + "package_name": "generated_4", + "path": "models/rendering/_sqlbuild/_macros/relations.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/relations.py", + "unique_id": "macro.generated_4.latest_rows", + "macro_sql": "from sqlbuild.refs import SqlResourceRef\n\n\ndef union_ids(relations: list[SqlResourceRef]) -> str:\n \"\"\"Union the ids of several relations.\"\"\"\n selects = [f\"SELECT id FROM {relation}\" for relation in relations]\n return \" UNION ALL \".join(selects)\n\n\ndef latest_rows(relation: SqlResourceRef, limit: int = 2) -> str:\n \"\"\"Return the newest rows of one relation.\"\"\"\n return f\"(SELECT id, amount FROM {relation} ORDER BY id DESC LIMIT {limit})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_4.union_ids": { + "name": "union_ids", + "resource_type": "macro", + "package_name": "generated_4", + "path": "models/rendering/_sqlbuild/_macros/relations.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/relations.py", + "unique_id": "macro.generated_4.union_ids", + "macro_sql": "from sqlbuild.refs import SqlResourceRef\n\n\ndef union_ids(relations: list[SqlResourceRef]) -> str:\n \"\"\"Union the ids of several relations.\"\"\"\n selects = [f\"SELECT id FROM {relation}\" for relation in relations]\n return \" UNION ALL \".join(selects)\n\n\ndef latest_rows(relation: SqlResourceRef, limit: int = 2) -> str:\n \"\"\"Return the newest rows of one relation.\"\"\"\n return f\"(SELECT id, amount FROM {relation} ORDER BY id DESC LIMIT {limit})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_4.adjust_2": { + "name": "adjust_2", + "resource_type": "macro", + "package_name": "generated_4", + "path": "models/support/_sqlbuild/macros/adjust_2.py", + "original_file_path": "models/support/_sqlbuild/macros/adjust_2.py", + "unique_id": "macro.generated_4.adjust_2", + "macro_sql": "def adjust_2_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_2(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_2_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [ + "macro.generated_4.adjust_2_round" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "inherited", + "sqlbuild_scope_path": "models/support" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_4.adjust_2_round": { + "name": "adjust_2_round", + "resource_type": "macro", + "package_name": "generated_4", + "path": "models/support/_sqlbuild/macros/adjust_2.py", + "original_file_path": "models/support/_sqlbuild/macros/adjust_2.py", + "unique_id": "macro.generated_4.adjust_2_round", + "macro_sql": "def adjust_2_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_2(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_2_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "inherited", + "sqlbuild_scope_path": "models/support" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_4.adjust_0": { + "name": "adjust_0", + "resource_type": "macro", + "package_name": "generated_4", + "path": "models/support/marts/_sqlbuild/_macros/adjust_0.py", + "original_file_path": "models/support/marts/_sqlbuild/_macros/adjust_0.py", + "unique_id": "macro.generated_4.adjust_0", + "macro_sql": "def adjust_0_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_0(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_0_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [ + "macro.generated_4.adjust_0_round" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/support/marts" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_4.adjust_0_round": { + "name": "adjust_0_round", + "resource_type": "macro", + "package_name": "generated_4", + "path": "models/support/marts/_sqlbuild/_macros/adjust_0.py", + "original_file_path": "models/support/marts/_sqlbuild/_macros/adjust_0.py", + "unique_id": "macro.generated_4.adjust_0_round", + "macro_sql": "def adjust_0_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_0(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_0_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/support/marts" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_4.adjust_1": { + "name": "adjust_1", + "resource_type": "macro", + "package_name": "generated_4", + "path": "models/support/marts/_sqlbuild/_macros/adjust_1.py", + "original_file_path": "models/support/marts/_sqlbuild/_macros/adjust_1.py", + "unique_id": "macro.generated_4.adjust_1", + "macro_sql": "def adjust_1_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_1(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_1_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [ + "macro.generated_4.adjust_1_round" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/support/marts" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_4.adjust_1_round": { + "name": "adjust_1_round", + "resource_type": "macro", + "package_name": "generated_4", + "path": "models/support/marts/_sqlbuild/_macros/adjust_1.py", + "original_file_path": "models/support/marts/_sqlbuild/_macros/adjust_1.py", + "unique_id": "macro.generated_4.adjust_1_round", + "macro_sql": "def adjust_1_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_1(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_1_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/support/marts" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_4__sqlbuild_hooks.record_refresh": { + "name": "record_refresh", + "resource_type": "macro", + "package_name": "generated_4__sqlbuild_hooks", + "path": "models/support/marts/_sqlbuild/_hooks/sql/record_refresh.sql", + "original_file_path": "models/support/marts/_sqlbuild/_hooks/sql/record_refresh.sql", + "unique_id": "macro.generated_4__sqlbuild_hooks.record_refresh", + "macro_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "depends_on": { + "macros": [] + }, + "description": "Record a refresh for one relation", + "meta": { + "sqlbuild_resource_type": "sql_hook", + "sqlbuild_hook_name": "record_refresh" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.generated_4.combined_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.every_open_event": [ + "source.generated_4.open_events" + ], + "model.generated_4.every_raw_events_0": [ + "source.generated_4.raw_events_0" + ], + "model.generated_4.every_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.passed_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.pivot_input_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.pivoted_stg_support_0": [ + "model.generated_4.pivot_input_stg_support_0" + ], + "model.generated_4.quoted_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.regional_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.typed_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.unanalysed_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.append_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.batched_rolling_window_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.guarded_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.product_labels": [ + "source.generated_4.loaded_products" + ], + "model.generated_4.shaped_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.timestamp_history_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.bounded_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.configured_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.latest_raw_events_0": [ + "source.generated_4.raw_events_0" + ], + "model.generated_4.policy_stg_support_0": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.unioned_event_ids": [ + "model.generated_4.stg_support_0" + ], + "model.generated_4.support_summary_0": [ + "model.generated_4.stg_support_0", + "seed.generated_4.lookup_1" + ], + "model.generated_4.support_summary_1": [ + "model.generated_4.stg_support_0", + "seed.generated_4.lookup_0" + ], + "model.generated_4.support_summary_2": [ + "model.generated_4.stg_support_0", + "seed.generated_4.lookup_1" + ], + "model.generated_4.stg_support_0": [ + "source.generated_4.raw_events_0" + ], + "source.generated_4.configured_events": [], + "source.generated_4.loaded_products": [], + "source.generated_4.open_events": [], + "source.generated_4.raw_events_0": [], + "seed.generated_4.lookup_0": [], + "seed.generated_4.lookup_1": [], + "model.generated_4.configured_label": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/seed/5.json b/tests/goldens/compiler/seed/5.json new file mode 100644 index 0000000000..a6ccbc7f30 --- /dev/null +++ b/tests/goldens/compiler/seed/5.json @@ -0,0 +1,48 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Macro name collision for 'adjust_0': macros/adjust_0.py and macros/duplicate_adjust_0.py" + } + ] + }, + { + "label": "compile-store-warm", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Macro name collision for 'adjust_0': macros/adjust_0.py and macros/duplicate_adjust_0.py" + } + ] + }, + { + "label": "plan", + "exit_code": 1, + "diagnostics": [ + "Project discovery START", + "Project assembly START", + "Declaration parsing START", + "Declaration parsing OK ()", + "Python discovery START", + "Python discovery OK ()", + "Project assembly OK ()", + "Project discovery OK ()", + "Compiling project...", + "error[P001]: Macro name collision for 'adjust_0': macros/adjust_0.py and macros/duplicate_adjust_0.py", + "", + "" + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/seed/6.json b/tests/goldens/compiler/seed/6.json new file mode 100644 index 0000000000..55ea99ab86 --- /dev/null +++ b/tests/goldens/compiler/seed/6.json @@ -0,0 +1,3234 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-store-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-select", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-no-analysis", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-rich-lineage", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "audits/generic/audited_stg_fulfillment_1/id_present__id.sql": [ + "SELECT id", + "FROM __ref(\"audited_stg_fulfillment_1\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/checked_stg_fulfillment_2/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"checked_stg_fulfillment_2\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'expédié', '取消', 'returned ✓')", + "" + ], + "audits/generic/checked_stg_fulfillment_2/expression_is_true.sql": [ + "SELECT *", + "FROM __ref(\"checked_stg_fulfillment_2\")", + "WHERE NOT (amount >= -1000)", + "" + ], + "audits/generic/checked_stg_fulfillment_2/relationships__id.sql": [ + "SELECT id", + "FROM __ref(\"checked_stg_fulfillment_2\")", + "WHERE id IS NOT NULL", + " AND id NOT IN (", + " SELECT id", + " FROM __ref(\"stg_fulfillment_2\")", + " WHERE id IS NOT NULL", + " )", + "" + ], + "audits/generic/fulfillment_summary_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"fulfillment_summary_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/sales_summary_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"sales_summary_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/sales_summary_1/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"sales_summary_1\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/shaped_stg_inventory_2/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"shaped_stg_inventory_2\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stated_stg_inventory_2/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"stated_stg_inventory_2\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'expédié', '取消', 'returned ✓')", + "" + ], + "audits/generic/stg_fulfillment_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_fulfillment_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_fulfillment_2/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_fulfillment_2\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_inventory_1/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_inventory_1\")", + "WHERE id IS NULL", + "" + ], + "functions/python/is_large.sql": [ + "REGISTER PYTHON FUNCTION is_large(DOUBLE) RETURNS BOOLEAN", + "" + ], + "functions/sql/is_placed.sql": [ + "CREATE OR REPLACE MACRO main.is_placed(event_status) AS (", + "event_status = 'placed'", + ")", + "" + ], + "functions/sql/table_fn__events_above.sql": [ + "CREATE OR REPLACE MACRO main.table_fn__events_above(p_minimum) AS TABLE", + "SELECT id, amount", + "FROM __ref(\"stg_sales_0\")", + "WHERE amount > p_minimum", + "" + ], + "models/analysis/chain_1_stg_fulfillment_2.sql": [ + "SELECT id, label, amount", + "FROM __ref(\"contracted_stg_fulfillment_2\")", + "" + ], + "models/analysis/chain_2_stg_fulfillment_2.sql": [ + "SELECT id, UPPER(label) AS label, amount", + "FROM __ref(\"chain_1_stg_fulfillment_2\")", + "" + ], + "models/analysis/chain_3_stg_fulfillment_2.sql": [ + "SELECT id, label, amount", + "FROM __ref(\"chain_2_stg_fulfillment_2\")", + "" + ], + "models/analysis/checked_stg_fulfillment_2.sql": [ + "SELECT id, amount, status", + "FROM __ref(\"stg_fulfillment_2\")", + "" + ], + "models/analysis/contracted_stg_fulfillment_2.sql": [ + "SELECT CAST(id AS INTEGER) AS id, CAST(status AS VARCHAR(18)) AS label,", + " amount", + "FROM __source(\"raw_events_0\")", + "" + ], + "models/analysis/regional_stg_fulfillment_0.sql": [ + "SELECT id, amount, 'north' AS region", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/features/audited_stg_fulfillment_1.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_fulfillment_1\")", + "" + ], + "models/features/batched_rolling_window_stg_sales_0.sql": [ + "SELECT CAST(created_at AS DATE) AS created_at, SUM(amount) AS amount", + "FROM __ref(\"stg_sales_0\")", + "GROUP BY CAST(created_at AS DATE)", + "" + ], + "models/features/check_history_stg_inventory_1.sql": [ + "SELECT id, status, amount", + "FROM __ref(\"stg_inventory_1\")", + "" + ], + "models/features/copied_stg_fulfillment_2.sql": [ + "SELECT id, status", + "FROM __ref(\"stg_fulfillment_2\")", + "" + ], + "models/features/flagged_stg_sales_0.sql": [ + "SELECT id, __udf(\"is_placed\")(status) AS is_placed,", + " __udf(\"is_large\")(amount) AS is_large", + "FROM __ref(\"stg_sales_0\")", + "" + ], + "models/features/hooked_stg_inventory_1.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_inventory_1\")", + "" + ], + "models/features/merge_stg_inventory_0.sql": [ + "SELECT id, amount, status, created_at", + "FROM __ref(\"stg_inventory_0\")", + "" + ], + "models/features/shaped_stg_inventory_2.sql": [ + "SELECT CAST(id AS INTEGER) AS id, status", + "FROM __ref(\"stg_inventory_2\")", + "" + ], + "models/features/spaced_stg_fulfillment_0.sql": [ + "-- Généré pour café ☕ counter", + "SELECT", + "\tid,", + "\t'Ελληνικά orders' AS label, -- étiquette ✓", + "\tamount", + "FROM __ref(\"stg_fulfillment_0\")", + "" + ], + "models/features/taxed_stg_inventory_0.sql": [ + "SELECT id, ROUND(amount * 1.2, 2) AS taxed, ROUND(amount, 1) AS rounded", + "FROM __ref(\"stg_inventory_0\")", + "" + ], + "models/fulfillment/marts/fulfillment_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 3 AS priority,", + " (t.amount + LENGTH('east')) AS adjust_1_amount", + "FROM __ref(\"stg_fulfillment_0\") t", + "" + ], + "models/fulfillment/staging/stg_fulfillment_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 3 AS priority,", + " 'Ελληνικά orders' AS threshold_0_label,", + " '東京 warehouse' AS site_label", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/fulfillment/staging/stg_fulfillment_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/fulfillment/staging/stg_fulfillment_2.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_0_amount", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/inventory/marts/inventory_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at", + "FROM __ref(\"stg_inventory_1\") t", + "WHERE t.status <> '取消'", + "" + ], + "models/inventory/marts/inventory_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at", + "FROM __ref(\"stg_inventory_2\") t", + "" + ], + "models/inventory/staging/stg_inventory_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " '東京 warehouse' AS site_label", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/inventory/staging/stg_inventory_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/inventory/staging/stg_inventory_2.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_0_amount,", + " '東京 warehouse' AS site_label", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/rendering/large_events.sql": [ + "SELECT id, amount", + "FROM __table_fn(\"table_fn__events_above\")(4)", + "" + ], + "models/rendering/stated_stg_inventory_2.sql": [ + "SELECT CAST(id AS INTEGER) AS id, status,", + " CASE WHEN amount >= 9 THEN 'HIGH'", + " ELSE 'LOW' END AS tier", + "FROM __ref(\"stg_inventory_2\")", + "" + ], + "models/sales/marts/sales_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " ROUND(ROUND((t.amount * 2), 2), 2) AS adjust_0_amount", + "FROM __ref(\"stg_sales_0\") t", + "" + ], + "models/sales/marts/sales_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at", + "FROM __ref(\"stg_sales_0\") t", + "LEFT JOIN __ref(\"stg_inventory_1\") j1 ON t.id = j1.id", + "" + ], + "models/sales/staging/stg_sales_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " '東京 warehouse' AS site_label", + "FROM __source(\"raw_events_0\") t", + "" + ], + "tests/macro doubles_amounts/doubles_amounts.sql": [ + "WITH input_values AS (SELECT 4 AS amount),", + "__actual__macro_doubles_amounts AS (SELECT (amount * 2) AS doubled", + " FROM input_values),", + "__expected__macro_doubles_amounts AS (SELECT 8 AS doubled)", + "SELECT 0 AS step_index, 'macro doubles_amounts' AS model_name, (SELECT COUNT(*) FROM __actual__macro_doubles_amounts) AS actual_count, (SELECT COUNT(*) FROM __expected__macro_doubles_amounts) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__macro_doubles_amounts EXCEPT SELECT * FROM __expected__macro_doubles_amounts) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__macro_doubles_amounts EXCEPT SELECT * FROM __actual__macro_doubles_amounts) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/macro taxes_amounts/taxes_amounts.sql": [ + "WITH input_values AS (SELECT 10 AS amount),", + "__actual__macro_taxes_amounts AS (SELECT ROUND(amount * 1.2, 2) AS taxed", + " FROM input_values),", + "__expected__macro_taxes_amounts AS (SELECT 12.0 AS taxed)", + "SELECT 0 AS step_index, 'macro taxes_amounts' AS model_name, (SELECT COUNT(*) FROM __actual__macro_taxes_amounts) AS actual_count, (SELECT COUNT(*) FROM __expected__macro_taxes_amounts) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__macro_taxes_amounts EXCEPT SELECT * FROM __expected__macro_taxes_amounts) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__macro_taxes_amounts EXCEPT SELECT * FROM __actual__macro_taxes_amounts) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/regional_stg_fulfillment_0/test_regional_stg_fulfillment_0.sql": [ + "WITH __ref__stg_fulfillment_0 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__regional_stg_fulfillment_0 AS (SELECT id, amount, 'west' AS region", + "FROM __ref__stg_fulfillment_0),", + "__actual__regional_stg_fulfillment_0 AS (SELECT * FROM __ref__regional_stg_fulfillment_0),", + "__expected__regional_stg_fulfillment_0 AS (SELECT 1 AS id, CAST(4 AS DOUBLE) AS amount, 'west' AS region)", + "SELECT 0 AS step_index, 'regional_stg_fulfillment_0' AS model_name, (SELECT COUNT(*) FROM __actual__regional_stg_fulfillment_0) AS actual_count, (SELECT COUNT(*) FROM __expected__regional_stg_fulfillment_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __actual__regional_stg_fulfillment_0 EXCEPT SELECT id, amount, region FROM __expected__regional_stg_fulfillment_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, amount, region FROM __expected__regional_stg_fulfillment_0 EXCEPT SELECT id, amount, region FROM __actual__regional_stg_fulfillment_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/stg_sales_0/test_stg_sales_0.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(10 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_sales_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " '東京 warehouse' AS site_label", + "FROM __source__raw_events_0 t),", + "__actual__stg_sales_0 AS (SELECT * FROM __ref__stg_sales_0),", + "__expected__stg_sales_0 AS (SELECT 1 AS id, 'placed' AS status)", + "SELECT 0 AS step_index, 'stg_sales_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_sales_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_sales_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __actual__stg_sales_0 EXCEPT SELECT id, status FROM __expected__stg_sales_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __expected__stg_sales_0 EXCEPT SELECT id, status FROM __actual__stg_sales_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/udf detects_placed_events/detects_placed_events.sql": [ + "WITH input_values AS (SELECT 'placed' AS event_status),", + "__actual__udf_detects_placed_events AS (SELECT event_status, main.is_placed(event_status) AS is_placed", + " FROM input_values),", + "__expected__udf_detects_placed_events AS (SELECT 'placed' AS event_status, TRUE AS is_placed)", + "SELECT 0 AS step_index, 'udf detects_placed_events' AS model_name, (SELECT COUNT(*) FROM __actual__udf_detects_placed_events) AS actual_count, (SELECT COUNT(*) FROM __expected__udf_detects_placed_events) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__udf_detects_placed_events EXCEPT SELECT * FROM __expected__udf_detects_placed_events) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__udf_detects_placed_events EXCEPT SELECT * FROM __actual__udf_detects_placed_events) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.generated_6.chain_1_stg_fulfillment_2": { + "database": null, + "schema": "main", + "name": "chain_1_stg_fulfillment_2", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/analysis/chain_1_stg_fulfillment_2.sql", + "original_file_path": "models/analysis/chain_1_stg_fulfillment_2.sql", + "unique_id": "model.generated_6.chain_1_stg_fulfillment_2", + "fqn": [ + "generated_6", + "models", + "analysis", + "chain_1_stg_fulfillment_2" + ], + "alias": "chain_1_stg_fulfillment_2", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Level 1 below the contracted copy of stg_fulfillment_2", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.chain_1_stg_fulfillment_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.contracted_stg_fulfillment_2" + ] + } + }, + "model.generated_6.chain_2_stg_fulfillment_2": { + "database": null, + "schema": "main", + "name": "chain_2_stg_fulfillment_2", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/analysis/chain_2_stg_fulfillment_2.sql", + "original_file_path": "models/analysis/chain_2_stg_fulfillment_2.sql", + "unique_id": "model.generated_6.chain_2_stg_fulfillment_2", + "fqn": [ + "generated_6", + "models", + "analysis", + "chain_2_stg_fulfillment_2" + ], + "alias": "chain_2_stg_fulfillment_2", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Level 2 below the contracted copy of stg_fulfillment_2", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.chain_2_stg_fulfillment_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.chain_1_stg_fulfillment_2" + ] + } + }, + "model.generated_6.chain_3_stg_fulfillment_2": { + "database": null, + "schema": "main", + "name": "chain_3_stg_fulfillment_2", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/analysis/chain_3_stg_fulfillment_2.sql", + "original_file_path": "models/analysis/chain_3_stg_fulfillment_2.sql", + "unique_id": "model.generated_6.chain_3_stg_fulfillment_2", + "fqn": [ + "generated_6", + "models", + "analysis", + "chain_3_stg_fulfillment_2" + ], + "alias": "chain_3_stg_fulfillment_2", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Level 3 below the contracted copy of stg_fulfillment_2", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.chain_3_stg_fulfillment_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.chain_2_stg_fulfillment_2" + ] + } + }, + "model.generated_6.checked_stg_fulfillment_2": { + "database": null, + "schema": "main", + "name": "checked_stg_fulfillment_2", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/analysis/checked_stg_fulfillment_2.sql", + "original_file_path": "models/analysis/checked_stg_fulfillment_2.sql", + "unique_id": "model.generated_6.checked_stg_fulfillment_2", + "fqn": [ + "generated_6", + "models", + "analysis", + "checked_stg_fulfillment_2" + ], + "alias": "checked_stg_fulfillment_2", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Metadata-checked copy of stg_fulfillment_2", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.checked_stg_fulfillment_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_fulfillment_2" + ] + } + }, + "model.generated_6.contracted_stg_fulfillment_2": { + "database": null, + "schema": "main", + "name": "contracted_stg_fulfillment_2", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/analysis/contracted_stg_fulfillment_2.sql", + "original_file_path": "models/analysis/contracted_stg_fulfillment_2.sql", + "unique_id": "model.generated_6.contracted_stg_fulfillment_2", + "fqn": [ + "generated_6", + "models", + "analysis", + "contracted_stg_fulfillment_2" + ], + "alias": "contracted_stg_fulfillment_2", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Contracted copy of raw_events_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR(18)", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.contracted_stg_fulfillment_2", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_6.raw_events_0" + ] + } + }, + "model.generated_6.regional_stg_fulfillment_0": { + "database": null, + "schema": "main", + "name": "regional_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/analysis/regional_stg_fulfillment_0.sql", + "original_file_path": "models/analysis/regional_stg_fulfillment_0.sql", + "unique_id": "model.generated_6.regional_stg_fulfillment_0", + "fqn": [ + "generated_6", + "models", + "analysis", + "regional_stg_fulfillment_0" + ], + "alias": "regional_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Regional copy of stg_fulfillment_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.regional_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_fulfillment_0" + ] + } + }, + "model.generated_6.audited_stg_fulfillment_1": { + "database": null, + "schema": "main", + "name": "audited_stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/features/audited_stg_fulfillment_1.sql", + "original_file_path": "models/features/audited_stg_fulfillment_1.sql", + "unique_id": "model.generated_6.audited_stg_fulfillment_1", + "fqn": [ + "generated_6", + "models", + "features", + "audited_stg_fulfillment_1" + ], + "alias": "audited_stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Factory-audited copy of stg_fulfillment_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.audited_stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_fulfillment_1" + ] + } + }, + "model.generated_6.batched_rolling_window_stg_sales_0": { + "database": null, + "schema": "main", + "name": "batched_rolling_window_stg_sales_0", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/features/batched_rolling_window_stg_sales_0.sql", + "original_file_path": "models/features/batched_rolling_window_stg_sales_0.sql", + "unique_id": "model.generated_6.batched_rolling_window_stg_sales_0", + "fqn": [ + "generated_6", + "models", + "features", + "batched_rolling_window_stg_sales_0" + ], + "alias": "batched_rolling_window_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Microbatched rolling_window totals of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.batched_rolling_window_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_sales_0" + ] + } + }, + "model.generated_6.check_history_stg_inventory_1": { + "database": null, + "schema": "main", + "name": "check_history_stg_inventory_1", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/features/check_history_stg_inventory_1.sql", + "original_file_path": "models/features/check_history_stg_inventory_1.sql", + "unique_id": "model.generated_6.check_history_stg_inventory_1", + "fqn": [ + "generated_6", + "models", + "features", + "check_history_stg_inventory_1" + ], + "alias": "check_history_stg_inventory_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "snapshot", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Check history of stg_inventory_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.check_history_stg_inventory_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_inventory_1" + ] + } + }, + "model.generated_6.copied_stg_fulfillment_2": { + "database": null, + "schema": "main", + "name": "copied_stg_fulfillment_2", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/features/copied_stg_fulfillment_2.sql", + "original_file_path": "models/features/copied_stg_fulfillment_2.sql", + "unique_id": "model.generated_6.copied_stg_fulfillment_2", + "fqn": [ + "generated_6", + "models", + "features", + "copied_stg_fulfillment_2" + ], + "alias": "copied_stg_fulfillment_2", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "copy_table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Custom copy of stg_fulfillment_2", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.copied_stg_fulfillment_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_fulfillment_2" + ] + } + }, + "model.generated_6.flagged_stg_sales_0": { + "database": null, + "schema": "main", + "name": "flagged_stg_sales_0", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/features/flagged_stg_sales_0.sql", + "original_file_path": "models/features/flagged_stg_sales_0.sql", + "unique_id": "model.generated_6.flagged_stg_sales_0", + "fqn": [ + "generated_6", + "models", + "features", + "flagged_stg_sales_0" + ], + "alias": "flagged_stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Function-flagged copy of stg_sales_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.flagged_stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.is_placed", + "model.generated_6.is_large", + "model.generated_6.stg_sales_0" + ] + } + }, + "model.generated_6.hooked_stg_inventory_1": { + "database": null, + "schema": "main", + "name": "hooked_stg_inventory_1", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/features/hooked_stg_inventory_1.sql", + "original_file_path": "models/features/hooked_stg_inventory_1.sql", + "unique_id": "model.generated_6.hooked_stg_inventory_1", + "fqn": [ + "generated_6", + "models", + "features", + "hooked_stg_inventory_1" + ], + "alias": "hooked_stg_inventory_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Hooked copy of stg_inventory_1", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "python", + "name": "note_refresh", + "kwargs": { + "channel": "café ☕ counter" + }, + "relative_path": "models/features/_sqlbuild/_hooks/python/notify.py", + "definition_hash": "55440ff19f0c4f231ad57d453227a3c9d584b81234ee4b3338a39ccdf59814a8", + "version_hash": "03b4f786f8ab2736e5be2e4de5016bd16ea44d84beca000ec2a53a397e503eb6" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.hooked_stg_inventory_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_inventory_1" + ] + } + }, + "model.generated_6.merge_stg_inventory_0": { + "database": null, + "schema": "main", + "name": "merge_stg_inventory_0", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/features/merge_stg_inventory_0.sql", + "original_file_path": "models/features/merge_stg_inventory_0.sql", + "unique_id": "model.generated_6.merge_stg_inventory_0", + "fqn": [ + "generated_6", + "models", + "features", + "merge_stg_inventory_0" + ], + "alias": "merge_stg_inventory_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "merge", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Incremental merge copy of stg_inventory_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.merge_stg_inventory_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_inventory_0" + ] + } + }, + "model.generated_6.shaped_stg_inventory_2": { + "database": null, + "schema": "main", + "name": "shaped_stg_inventory_2", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/features/shaped_stg_inventory_2.sql", + "original_file_path": "models/features/shaped_stg_inventory_2.sql", + "unique_id": "model.generated_6.shaped_stg_inventory_2", + "fqn": [ + "generated_6", + "models", + "features", + "shaped_stg_inventory_2" + ], + "alias": "shaped_stg_inventory_2", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Schema-shaped copy of stg_inventory_2", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.shaped_stg_inventory_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_inventory_2" + ] + } + }, + "model.generated_6.spaced_stg_fulfillment_0": { + "database": null, + "schema": "main", + "name": "spaced_stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/features/spaced_stg_fulfillment_0.sql", + "original_file_path": "models/features/spaced_stg_fulfillment_0.sql", + "unique_id": "model.generated_6.spaced_stg_fulfillment_0", + "fqn": [ + "generated_6", + "models", + "features", + "spaced_stg_fulfillment_0" + ], + "alias": "spaced_stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "línea", + "東京" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "línea", + "東京" + ], + "description": "Copy of stg_fulfillment_0 with 東京 warehouse", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.spaced_stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_fulfillment_0" + ] + } + }, + "model.generated_6.taxed_stg_inventory_0": { + "database": null, + "schema": "main", + "name": "taxed_stg_inventory_0", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/features/taxed_stg_inventory_0.sql", + "original_file_path": "models/features/taxed_stg_inventory_0.sql", + "unique_id": "model.generated_6.taxed_stg_inventory_0", + "fqn": [ + "generated_6", + "models", + "features", + "taxed_stg_inventory_0" + ], + "alias": "taxed_stg_inventory_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Taxed copy of stg_inventory_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.taxed_stg_inventory_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_inventory_0" + ] + } + }, + "model.generated_6.fulfillment_summary_0": { + "database": null, + "schema": "main", + "name": "fulfillment_summary_0", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/fulfillment/marts/fulfillment_summary_0.sql", + "original_file_path": "models/fulfillment/marts/fulfillment_summary_0.sql", + "unique_id": "model.generated_6.fulfillment_summary_0", + "fqn": [ + "generated_6", + "models", + "fulfillment", + "marts", + "fulfillment_summary_0" + ], + "alias": "fulfillment_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "fulfillment", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'main.fulfillment_summary_0' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'main.fulfillment_summary_0' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "fulfillment", + "marts" + ], + "description": "Summary of fulfillment activity 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'main.fulfillment_summary_0' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "Ελληνικά orders" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'main.fulfillment_summary_0' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.fulfillment_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_fulfillment_0" + ] + } + }, + "model.generated_6.stg_fulfillment_0": { + "database": null, + "schema": "main", + "name": "stg_fulfillment_0", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/fulfillment/staging/stg_fulfillment_0.sql", + "original_file_path": "models/fulfillment/staging/stg_fulfillment_0.sql", + "unique_id": "model.generated_6.stg_fulfillment_0", + "fqn": [ + "generated_6", + "models", + "fulfillment", + "staging", + "stg_fulfillment_0" + ], + "alias": "stg_fulfillment_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged fulfillment events 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_fulfillment_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_6.raw_events_0" + ] + } + }, + "model.generated_6.stg_fulfillment_1": { + "database": null, + "schema": "main", + "name": "stg_fulfillment_1", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/fulfillment/staging/stg_fulfillment_1.sql", + "original_file_path": "models/fulfillment/staging/stg_fulfillment_1.sql", + "unique_id": "model.generated_6.stg_fulfillment_1", + "fqn": [ + "generated_6", + "models", + "fulfillment", + "staging", + "stg_fulfillment_1" + ], + "alias": "stg_fulfillment_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged fulfillment events 1 (東京 warehouse)", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_fulfillment_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_6.raw_events_0" + ] + } + }, + "model.generated_6.stg_fulfillment_2": { + "database": null, + "schema": "main", + "name": "stg_fulfillment_2", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/fulfillment/staging/stg_fulfillment_2.sql", + "original_file_path": "models/fulfillment/staging/stg_fulfillment_2.sql", + "unique_id": "model.generated_6.stg_fulfillment_2", + "fqn": [ + "generated_6", + "models", + "fulfillment", + "staging", + "stg_fulfillment_2" + ], + "alias": "stg_fulfillment_2", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged fulfillment events 2", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_fulfillment_2", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_6.raw_events_0" + ] + } + }, + "model.generated_6.inventory_summary_0": { + "database": null, + "schema": "main", + "name": "inventory_summary_0", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/inventory/marts/inventory_summary_0.sql", + "original_file_path": "models/inventory/marts/inventory_summary_0.sql", + "unique_id": "model.generated_6.inventory_summary_0", + "fqn": [ + "generated_6", + "models", + "inventory", + "marts", + "inventory_summary_0" + ], + "alias": "inventory_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "inventory", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'main.inventory_summary_0' AS refreshed_relation, 'naïve résumé' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'main.inventory_summary_0' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "inventory", + "marts" + ], + "description": "Summary of inventory activity 0", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'main.inventory_summary_0' AS refreshed_relation, 'naïve résumé' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "naïve résumé" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'main.inventory_summary_0' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.inventory_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_inventory_1" + ] + } + }, + "model.generated_6.inventory_summary_1": { + "database": null, + "schema": "main", + "name": "inventory_summary_1", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/inventory/marts/inventory_summary_1.sql", + "original_file_path": "models/inventory/marts/inventory_summary_1.sql", + "unique_id": "model.generated_6.inventory_summary_1", + "fqn": [ + "generated_6", + "models", + "inventory", + "marts", + "inventory_summary_1" + ], + "alias": "inventory_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "inventory", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'main.inventory_summary_1' AS refreshed_relation, 'café ☕ counter' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'main.inventory_summary_1' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "inventory", + "marts" + ], + "description": "Summary of inventory activity 1", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'main.inventory_summary_1' AS refreshed_relation, 'café ☕ counter' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "café ☕ counter" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'main.inventory_summary_1' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.inventory_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_inventory_2" + ] + } + }, + "model.generated_6.stg_inventory_0": { + "database": null, + "schema": "main", + "name": "stg_inventory_0", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/inventory/staging/stg_inventory_0.sql", + "original_file_path": "models/inventory/staging/stg_inventory_0.sql", + "unique_id": "model.generated_6.stg_inventory_0", + "fqn": [ + "generated_6", + "models", + "inventory", + "staging", + "stg_inventory_0" + ], + "alias": "stg_inventory_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged inventory events 0 (Ελληνικά orders)", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_inventory_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_6.raw_events_0" + ] + } + }, + "model.generated_6.stg_inventory_1": { + "database": null, + "schema": "main", + "name": "stg_inventory_1", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/inventory/staging/stg_inventory_1.sql", + "original_file_path": "models/inventory/staging/stg_inventory_1.sql", + "unique_id": "model.generated_6.stg_inventory_1", + "fqn": [ + "generated_6", + "models", + "inventory", + "staging", + "stg_inventory_1" + ], + "alias": "stg_inventory_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged inventory events 1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_inventory_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_6.raw_events_0" + ] + } + }, + "model.generated_6.stg_inventory_2": { + "database": null, + "schema": "main", + "name": "stg_inventory_2", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/inventory/staging/stg_inventory_2.sql", + "original_file_path": "models/inventory/staging/stg_inventory_2.sql", + "unique_id": "model.generated_6.stg_inventory_2", + "fqn": [ + "generated_6", + "models", + "inventory", + "staging", + "stg_inventory_2" + ], + "alias": "stg_inventory_2", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged inventory events 2", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_inventory_2", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_6.raw_events_0" + ] + } + }, + "model.generated_6.large_events": { + "database": null, + "schema": "main", + "name": "large_events", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/rendering/large_events.sql", + "original_file_path": "models/rendering/large_events.sql", + "unique_id": "model.generated_6.large_events", + "fqn": [ + "generated_6", + "models", + "rendering", + "large_events" + ], + "alias": "large_events", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Events above a threshold from a table function", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.large_events", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.table_fn__events_above" + ] + } + }, + "model.generated_6.stated_stg_inventory_2": { + "database": null, + "schema": "main", + "name": "stated_stg_inventory_2", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/rendering/stated_stg_inventory_2.sql", + "original_file_path": "models/rendering/stated_stg_inventory_2.sql", + "unique_id": "model.generated_6.stated_stg_inventory_2", + "fqn": [ + "generated_6", + "models", + "rendering", + "stated_stg_inventory_2" + ], + "alias": "stated_stg_inventory_2", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Enum-typed copy of stg_inventory_2", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "tier": { + "name": "tier", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stated_stg_inventory_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_inventory_2" + ] + } + }, + "model.generated_6.sales_summary_0": { + "database": null, + "schema": "main", + "name": "sales_summary_0", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/sales/marts/sales_summary_0.sql", + "original_file_path": "models/sales/marts/sales_summary_0.sql", + "unique_id": "model.generated_6.sales_summary_0", + "fqn": [ + "generated_6", + "models", + "sales", + "marts", + "sales_summary_0" + ], + "alias": "sales_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'main.sales_summary_0' AS refreshed_relation, '東京 warehouse' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'main.sales_summary_0' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of sales activity 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'main.sales_summary_0' AS refreshed_relation, '東京 warehouse' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "東京 warehouse" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'main.sales_summary_0' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.sales_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_sales_0" + ] + } + }, + "model.generated_6.sales_summary_1": { + "database": null, + "schema": "main", + "name": "sales_summary_1", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/sales/marts/sales_summary_1.sql", + "original_file_path": "models/sales/marts/sales_summary_1.sql", + "unique_id": "model.generated_6.sales_summary_1", + "fqn": [ + "generated_6", + "models", + "sales", + "marts", + "sales_summary_1" + ], + "alias": "sales_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of sales activity 1 (café ☕ counter)", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.sales_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_6.stg_sales_0", + "model.generated_6.stg_inventory_1" + ] + } + }, + "model.generated_6.stg_sales_0": { + "database": null, + "schema": "main", + "name": "stg_sales_0", + "resource_type": "model", + "package_name": "generated_6", + "path": "models/sales/staging/stg_sales_0.sql", + "original_file_path": "models/sales/staging/stg_sales_0.sql", + "unique_id": "model.generated_6.stg_sales_0", + "fqn": [ + "generated_6", + "models", + "sales", + "staging", + "stg_sales_0" + ], + "alias": "stg_sales_0", + "config": { + "enabled": true, + "alias": null, + "schema": "main", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged sales events 0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "main.stg_sales_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_6.raw_events_0" + ] + } + } + }, + "sources": { + "source.generated_6.raw_events_0": { + "database": null, + "schema": "", + "name": "raw_events_0", + "resource_type": "source", + "package_name": "generated_6", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_6.raw_events_0", + "fqn": [ + "generated_6", + "raw_events_0" + ], + "source_name": "raw_events_0", + "source_description": "", + "loader": "", + "identifier": "raw_events_0", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.generated_6.adjust_0": { + "name": "adjust_0", + "resource_type": "macro", + "package_name": "generated_6", + "path": "macros/adjust_0.py", + "original_file_path": "macros/adjust_0.py", + "unique_id": "macro.generated_6.adjust_0", + "macro_sql": "def adjust_0_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_0(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_0_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [ + "macro.generated_6.adjust_0_round" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_6.adjust_0_round": { + "name": "adjust_0_round", + "resource_type": "macro", + "package_name": "generated_6", + "path": "macros/adjust_0.py", + "original_file_path": "macros/adjust_0.py", + "unique_id": "macro.generated_6.adjust_0_round", + "macro_sql": "def adjust_0_round(expression: str) -> str:\n \"\"\"Round an amount to two places.\"\"\"\n return f\"ROUND({expression}, 2)\"\n\n\ndef adjust_0(expression: str) -> str:\n \"\"\"Double and round an amount.\"\"\"\n return adjust_0_round(f\"({expression} * 2)\")\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_6.round_amount": { + "name": "round_amount", + "resource_type": "macro", + "package_name": "generated_6", + "path": "macros/rounding.py", + "original_file_path": "macros/rounding.py", + "unique_id": "macro.generated_6.round_amount", + "macro_sql": "def round_amount(expression: str, places: int = 2) -> str:\n \"\"\"Round an amount.\"\"\"\n return f\"ROUND({expression}, {places})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_6.taxed": { + "name": "taxed", + "resource_type": "macro", + "package_name": "generated_6", + "path": "macros/tax.py", + "original_file_path": "macros/tax.py", + "unique_id": "macro.generated_6.taxed", + "macro_sql": "from macros.rounding import round_amount\n\n\ndef taxed(expression: str) -> str:\n \"\"\"Add tax to an amount, rounded.\"\"\"\n return round_amount(f\"{expression} * 1.2\")\n", + "depends_on": { + "macros": [ + "macro.generated_6.round_amount" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_6.analysis_region": { + "name": "analysis_region", + "resource_type": "macro", + "package_name": "generated_6", + "path": "models/analysis/_sqlbuild/_macros/regions.py", + "original_file_path": "models/analysis/_sqlbuild/_macros/regions.py", + "unique_id": "macro.generated_6.analysis_region", + "macro_sql": "def analysis_region() -> str:\n \"\"\"Return the region rows are assigned to.\"\"\"\n return \"'north'\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/analysis" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_6.adjust_1": { + "name": "adjust_1", + "resource_type": "macro", + "package_name": "generated_6", + "path": "models/fulfillment/marts/_sqlbuild/_macros/adjust_1.py", + "original_file_path": "models/fulfillment/marts/_sqlbuild/_macros/adjust_1.py", + "unique_id": "macro.generated_6.adjust_1", + "macro_sql": "import os\n\n\ndef adjust_1(expression: str) -> str:\n \"\"\"Tag an amount with the deployment region.\"\"\"\n region = os.environ.get(\"SQB_DIFFERENTIAL_REGION\", \"east\")\n return f\"({expression} + LENGTH('{region}'))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/fulfillment/marts" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_6.doubled": { + "name": "doubled", + "resource_type": "macro", + "package_name": "generated_6", + "path": "tests/unit/_macros/scaling.py", + "original_file_path": "tests/unit/_macros/scaling.py", + "unique_id": "macro.generated_6.doubled", + "macro_sql": "def doubled(expression: str) -> str:\n \"\"\"Double an amount.\"\"\"\n return f\"({expression} * 2)\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "tests/unit" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_6__sqlbuild_hooks.record_refresh": { + "name": "record_refresh", + "resource_type": "macro", + "package_name": "generated_6__sqlbuild_hooks", + "path": "hooks/sql/record_refresh.sql", + "original_file_path": "hooks/sql/record_refresh.sql", + "unique_id": "macro.generated_6__sqlbuild_hooks.record_refresh", + "macro_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "depends_on": { + "macros": [] + }, + "description": "Record a refresh for one relation", + "meta": { + "sqlbuild_resource_type": "sql_hook", + "sqlbuild_hook_name": "record_refresh" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.generated_6.chain_1_stg_fulfillment_2": [ + "model.generated_6.contracted_stg_fulfillment_2" + ], + "model.generated_6.chain_2_stg_fulfillment_2": [ + "model.generated_6.chain_1_stg_fulfillment_2" + ], + "model.generated_6.chain_3_stg_fulfillment_2": [ + "model.generated_6.chain_2_stg_fulfillment_2" + ], + "model.generated_6.checked_stg_fulfillment_2": [ + "model.generated_6.stg_fulfillment_2" + ], + "model.generated_6.contracted_stg_fulfillment_2": [ + "source.generated_6.raw_events_0" + ], + "model.generated_6.regional_stg_fulfillment_0": [ + "model.generated_6.stg_fulfillment_0" + ], + "model.generated_6.audited_stg_fulfillment_1": [ + "model.generated_6.stg_fulfillment_1" + ], + "model.generated_6.batched_rolling_window_stg_sales_0": [ + "model.generated_6.stg_sales_0" + ], + "model.generated_6.check_history_stg_inventory_1": [ + "model.generated_6.stg_inventory_1" + ], + "model.generated_6.copied_stg_fulfillment_2": [ + "model.generated_6.stg_fulfillment_2" + ], + "model.generated_6.flagged_stg_sales_0": [ + "model.generated_6.is_placed", + "model.generated_6.is_large", + "model.generated_6.stg_sales_0" + ], + "model.generated_6.hooked_stg_inventory_1": [ + "model.generated_6.stg_inventory_1" + ], + "model.generated_6.merge_stg_inventory_0": [ + "model.generated_6.stg_inventory_0" + ], + "model.generated_6.shaped_stg_inventory_2": [ + "model.generated_6.stg_inventory_2" + ], + "model.generated_6.spaced_stg_fulfillment_0": [ + "model.generated_6.stg_fulfillment_0" + ], + "model.generated_6.taxed_stg_inventory_0": [ + "model.generated_6.stg_inventory_0" + ], + "model.generated_6.fulfillment_summary_0": [ + "model.generated_6.stg_fulfillment_0" + ], + "model.generated_6.stg_fulfillment_0": [ + "source.generated_6.raw_events_0" + ], + "model.generated_6.stg_fulfillment_1": [ + "source.generated_6.raw_events_0" + ], + "model.generated_6.stg_fulfillment_2": [ + "source.generated_6.raw_events_0" + ], + "model.generated_6.inventory_summary_0": [ + "model.generated_6.stg_inventory_1" + ], + "model.generated_6.inventory_summary_1": [ + "model.generated_6.stg_inventory_2" + ], + "model.generated_6.stg_inventory_0": [ + "source.generated_6.raw_events_0" + ], + "model.generated_6.stg_inventory_1": [ + "source.generated_6.raw_events_0" + ], + "model.generated_6.stg_inventory_2": [ + "source.generated_6.raw_events_0" + ], + "model.generated_6.large_events": [ + "model.generated_6.table_fn__events_above" + ], + "model.generated_6.stated_stg_inventory_2": [ + "model.generated_6.stg_inventory_2" + ], + "model.generated_6.sales_summary_0": [ + "model.generated_6.stg_sales_0" + ], + "model.generated_6.sales_summary_1": [ + "model.generated_6.stg_sales_0", + "model.generated_6.stg_inventory_1" + ], + "model.generated_6.stg_sales_0": [ + "source.generated_6.raw_events_0" + ], + "source.generated_6.raw_events_0": [], + "model.generated_6.is_placed": [], + "model.generated_6.table_fn__events_above": [ + "model.generated_6.stg_sales_0" + ], + "model.generated_6.is_large": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/seed/7.json b/tests/goldens/compiler/seed/7.json new file mode 100644 index 0000000000..3d5cdcde4e --- /dev/null +++ b/tests/goldens/compiler/seed/7.json @@ -0,0 +1,48 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Unknown macro '@not_a_macro' in '/models/inventory/marts/inventory_summary_0.sql'. Available macros: adjust_0, adjust_1" + } + ] + }, + { + "label": "compile-store-warm", + "exit_code": 1, + "diagnostics": [ + { + "phase": "compile", + "severity": "error", + "code": "P001", + "message": "Unknown macro '@not_a_macro' in '/models/inventory/marts/inventory_summary_0.sql'. Available macros: adjust_0, adjust_1" + } + ] + }, + { + "label": "plan", + "exit_code": 1, + "diagnostics": [ + "Project discovery START", + "Project assembly START", + "Declaration parsing START", + "Declaration parsing OK ()", + "Python discovery START", + "Python discovery OK ()", + "Project assembly OK ()", + "Project discovery OK ()", + "Compiling project...", + "error[P001]: Unknown macro '@not_a_macro' in '/models/inventory/marts/inventory_summary_0.sql'. Available macros: adjust_0, adjust_1", + "", + "" + ] + } + ], + "compiled": {}, + "manifest": null +} diff --git a/tests/goldens/compiler/seed/8.json b/tests/goldens/compiler/seed/8.json new file mode 100644 index 0000000000..cbc5d67c7d --- /dev/null +++ b/tests/goldens/compiler/seed/8.json @@ -0,0 +1,2770 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-store-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "audits/generic/audited_stg_support_0/id_present__id.sql": [ + "SELECT id", + "FROM __ref(\"audited_stg_support_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/checked_stg_support_0/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"checked_stg_support_0\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'expédié', '取消', 'returned ✓')", + "" + ], + "audits/generic/checked_stg_support_0/expression_is_true.sql": [ + "SELECT *", + "FROM __ref(\"checked_stg_support_0\")", + "WHERE NOT (amount >= -1000)", + "" + ], + "audits/generic/checked_stg_support_0/relationships__id.sql": [ + "SELECT id", + "FROM __ref(\"checked_stg_support_0\")", + "WHERE id IS NOT NULL", + " AND id NOT IN (", + " SELECT id", + " FROM __ref(\"stg_support_0\")", + " WHERE id IS NOT NULL", + " )", + "" + ], + "audits/generic/configured_events/accepted_values__id.sql": [ + "SELECT id", + "FROM __source(\"configured_events\")", + "WHERE id IS NOT NULL", + " AND id NOT IN ('1')", + "" + ], + "audits/generic/configured_stg_support_0/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"configured_stg_support_0\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'shipped')", + "" + ], + "audits/generic/configured_stg_support_0/configured_amount_floor.sql": [ + "SELECT *", + "FROM __ref(\"configured_stg_support_0\")", + "WHERE amount < -40", + "" + ], + "audits/generic/configured_stg_support_0/configured_id_present__id.sql": [ + "SELECT id", + "FROM __ref(\"configured_stg_support_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/configured_stg_support_0/unique__id.sql": [ + "SELECT id, COUNT(*) AS duplicate_count", + "FROM __ref(\"configured_stg_support_0\")", + "WHERE id IS NOT NULL", + "GROUP BY id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/labelled_stg_support_0/tidy_status__status.sql": [ + "SELECT *", + "FROM __ref(\"labelled_stg_support_0\")", + "WHERE status <> LOWER(TRIM(status))", + "" + ], + "audits/generic/shaped_stg_support_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"shaped_stg_support_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/stg_support_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_support_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/support_summary_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"support_summary_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/support_summary_1/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"support_summary_1\")", + "WHERE id IS NULL", + "" + ], + "audits/singular/labelled_channels_match.sql": [ + "SELECT l.id", + "FROM __ref(\"labelled_stg_support_0\") l", + "JOIN __ref(\"channel_labels\") c ON l.id = c.id", + "WHERE l.status = c.channel", + "" + ], + "functions/sql/configured_label.sql": [ + "CREATE OR REPLACE MACRO ci_checks.configured_label(raw_status) AS (", + "UPPER(raw_status)", + ")", + "" + ], + "functions/sql/tidy_status.sql": [ + "CREATE OR REPLACE MACRO ci_checks.tidy_status(raw_status) AS (", + "LOWER(TRIM(raw_status))", + ")", + "" + ], + "models/analysis/checked_stg_support_0.sql": [ + "SELECT id, amount, status", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/analysis/pivot_input_stg_support_0.sql": [ + "SELECT CAST(id AS INTEGER) AS id, CAST(status AS VARCHAR) AS status, amount", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/analysis/pivoted_stg_support_0.sql": [ + "PIVOT __ref(\"pivot_input_stg_support_0\")", + "ON status", + "USING MAX(amount)", + "GROUP BY id", + "" + ], + "models/analysis/unanalysed_stg_support_0.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_support_0\")", + "WHERE id = ANY [1, 2]", + "" + ], + "models/features/append_stg_support_0.sql": [ + "SELECT id, amount, status, created_at", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/features/audited_stg_support_0.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/features/batched_rolling_window_stg_support_0.sql": [ + "SELECT CAST(created_at AS DATE) AS created_at, SUM(amount) AS amount", + "FROM __ref(\"stg_support_0\")", + "GROUP BY CAST(created_at AS DATE)", + "" + ], + "models/features/hooked_stg_support_0.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/features/product_labels.sql": [ + "SELECT id, label", + "FROM __source(\"loaded_products\")", + "" + ], + "models/features/shaped_stg_support_0.sql": [ + "SELECT CAST(id AS INTEGER) AS id, status", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/features/taxed_stg_support_0.sql": [ + "SELECT id, ROUND(amount * 1.2, 2) AS taxed, ROUND(amount, 1) AS rounded", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/rendering/bounded_stg_support_0.sql": [ + "SELECT id, amount, created_at", + "FROM __ref(\"stg_support_0\")", + "WHERE created_at >= __cursor_start()", + " AND created_at < __cursor_end()", + "" + ], + "models/rendering/channel_labels.sql": [ + "SELECT id, channel", + "FROM __source(\"labelled_channels\")", + "" + ], + "models/rendering/configured_stg_support_0.sql": [ + "SELECT id, amount, status", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/rendering/labelled_stg_support_0.sql": [ + "SELECT id, LOWER(TRIM(status)) AS status,", + " __udf(\"tidy_status\")(status) AS tidied", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/rendering/latest_raw_events_1.sql": [ + "SELECT id, amount", + "FROM (SELECT id, amount FROM __source(\"raw_events_1\") ORDER BY id DESC LIMIT 2) AS latest", + "" + ], + "models/rendering/unioned_event_ids.sql": [ + "SELECT id", + "FROM (SELECT id FROM __ref(\"stg_support_0\") UNION ALL SELECT id FROM __ref(\"stg_support_0\")) AS unioned", + "" + ], + "models/support/marts/support_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount + 50 AS threshold_2_amount,", + " (t.amount * (1 - 0.15)) AS adjust_0_amount,", + " (t.amount + 2 + 1) AS adjust_2_amount", + "FROM __ref(\"stg_support_0\") t", + "WHERE t.status <> 'placed'", + "" + ], + "models/support/marts/support_summary_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount + 237 AS threshold_0_amount,", + " (t.amount * (1 - 0.15)) AS adjust_0_amount,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " 'naïve résumé' AS site_label", + "FROM __ref(\"stg_support_0\") t", + "" + ], + "models/support/marts/support_summary_2.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * 0.15 AS threshold_1_amount,", + " t.amount + 50 AS threshold_2_amount,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " (t.amount + 2 + 1) AS adjust_2_amount", + "FROM __ref(\"stg_support_0\") t", + "" + ], + "models/support/staging/stg_support_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount + 237 AS threshold_0_amount,", + " t.amount + 50 AS threshold_2_amount,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " (t.amount + 2 + 1) AS adjust_2_amount", + "FROM __source(\"raw_events_0\") t", + "WHERE t.status <> 'expédié'", + "" + ], + "tests/_chain_/labelled_stg_support_0__stg_support_0/test_labelled_stg_support_0.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(1 AS DOUBLE) AS amount, 'placed' AS status, TIMESTAMP '2026-01-01 00:00:00' AS created_at UNION ALL SELECT 2 AS id, CAST(2 AS DOUBLE) AS amount, 'placed' AS status, TIMESTAMP '2026-01-02 00:00:00' AS created_at),", + "__ref__stg_support_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount + 237 AS threshold_0_amount,", + " t.amount + 50 AS threshold_2_amount,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " (t.amount + 2 + 1) AS adjust_2_amount", + "FROM __source__raw_events_0 t", + "WHERE t.status <> 'expédié'),", + "__ref__labelled_stg_support_0 AS (SELECT id, LOWER(TRIM(status)) AS status,", + " ci_checks.tidy_status(status) AS tidied", + "FROM __ref__stg_support_0),", + "__actual__labelled_stg_support_0 AS (SELECT * FROM __ref__labelled_stg_support_0),", + "__expected__labelled_stg_support_0 AS (SELECT 1 AS id, LOWER(TRIM('placed')) AS status", + " UNION ALL", + " SELECT 2 AS id, 'placed' AS status)", + "SELECT 1 AS step_index, 'labelled_stg_support_0' AS model_name, (SELECT COUNT(*) FROM __actual__labelled_stg_support_0) AS actual_count, (SELECT COUNT(*) FROM __expected__labelled_stg_support_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __actual__labelled_stg_support_0 EXCEPT SELECT id, status FROM __expected__labelled_stg_support_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __expected__labelled_stg_support_0 EXCEPT SELECT id, status FROM __actual__labelled_stg_support_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/macro doubles_amounts/doubles_amounts.sql": [ + "WITH input_values AS (SELECT 4 AS amount),", + "__actual__macro_doubles_amounts AS (SELECT (amount * 2) AS doubled", + " FROM input_values),", + "__expected__macro_doubles_amounts AS (SELECT 8 AS doubled)", + "SELECT 0 AS step_index, 'macro doubles_amounts' AS model_name, (SELECT COUNT(*) FROM __actual__macro_doubles_amounts) AS actual_count, (SELECT COUNT(*) FROM __expected__macro_doubles_amounts) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__macro_doubles_amounts EXCEPT SELECT * FROM __expected__macro_doubles_amounts) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__macro_doubles_amounts EXCEPT SELECT * FROM __actual__macro_doubles_amounts) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/macro taxes_amounts/taxes_amounts.sql": [ + "WITH input_values AS (SELECT 10 AS amount),", + "__actual__macro_taxes_amounts AS (SELECT ROUND(amount * 1.2, 2) AS taxed", + " FROM input_values),", + "__expected__macro_taxes_amounts AS (SELECT 12.0 AS taxed)", + "SELECT 0 AS step_index, 'macro taxes_amounts' AS model_name, (SELECT COUNT(*) FROM __actual__macro_taxes_amounts) AS actual_count, (SELECT COUNT(*) FROM __expected__macro_taxes_amounts) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__macro_taxes_amounts EXCEPT SELECT * FROM __expected__macro_taxes_amounts) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__macro_taxes_amounts EXCEPT SELECT * FROM __actual__macro_taxes_amounts) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/stg_support_0/test_stg_support_0.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(10 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_support_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount + 237 AS threshold_0_amount,", + " t.amount + 50 AS threshold_2_amount,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " (t.amount + 2 + 1) AS adjust_2_amount", + "FROM __source__raw_events_0 t", + "WHERE t.status <> 'expédié'),", + "__actual__stg_support_0 AS (SELECT * FROM __ref__stg_support_0),", + "__expected__stg_support_0 AS (SELECT 1 AS id, 'placed' AS status)", + "SELECT 0 AS step_index, 'stg_support_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_support_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_support_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __actual__stg_support_0 EXCEPT SELECT id, status FROM __expected__stg_support_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __expected__stg_support_0 EXCEPT SELECT id, status FROM __actual__stg_support_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/tests/unit/test_stg_support_0_cases/block_1__labelled.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(2.25 AS DOUBLE) AS amount,", + " 'café ☕ counter' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_support_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount + 237 AS threshold_0_amount,", + " t.amount + 50 AS threshold_2_amount,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " (t.amount + 2 + 1) AS adjust_2_amount", + "FROM __source__raw_events_0 t", + "WHERE t.status <> 'expédié'),", + "__actual__stg_support_0 AS (SELECT * FROM __ref__stg_support_0),", + "__expected__stg_support_0 AS (SELECT 1 AS id)", + "SELECT 0 AS step_index, 'stg_support_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_support_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_support_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id FROM __actual__stg_support_0 EXCEPT SELECT id FROM __expected__stg_support_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id FROM __expected__stg_support_0 EXCEPT SELECT id FROM __actual__stg_support_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/tests/unit/test_stg_support_0_cases/block_1__placed.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(1.5 AS DOUBLE) AS amount,", + " 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_support_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount + 237 AS threshold_0_amount,", + " t.amount + 50 AS threshold_2_amount,", + " (t.amount + LENGTH('east')) AS adjust_1_amount,", + " (t.amount + 2 + 1) AS adjust_2_amount", + "FROM __source__raw_events_0 t", + "WHERE t.status <> 'expédié'),", + "__actual__stg_support_0 AS (SELECT * FROM __ref__stg_support_0),", + "__expected__stg_support_0 AS (SELECT 1 AS id)", + "SELECT 0 AS step_index, 'stg_support_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_support_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_support_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id FROM __actual__stg_support_0 EXCEPT SELECT id FROM __expected__stg_support_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id FROM __expected__stg_support_0 EXCEPT SELECT id FROM __actual__stg_support_0) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.generated_8.checked_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "checked_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/analysis/checked_stg_support_0.sql", + "original_file_path": "models/analysis/checked_stg_support_0.sql", + "unique_id": "model.generated_8.checked_stg_support_0", + "fqn": [ + "generated_8", + "models", + "analysis", + "checked_stg_support_0" + ], + "alias": "checked_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Metadata-checked copy of stg_support_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.checked_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.pivot_input_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "pivot_input_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/analysis/pivot_input_stg_support_0.sql", + "original_file_path": "models/analysis/pivot_input_stg_support_0.sql", + "unique_id": "model.generated_8.pivot_input_stg_support_0", + "fqn": [ + "generated_8", + "models", + "analysis", + "pivot_input_stg_support_0" + ], + "alias": "pivot_input_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Contracted pivot input from stg_support_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.pivot_input_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.pivoted_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "pivoted_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/analysis/pivoted_stg_support_0.sql", + "original_file_path": "models/analysis/pivoted_stg_support_0.sql", + "unique_id": "model.generated_8.pivoted_stg_support_0", + "fqn": [ + "generated_8", + "models", + "analysis", + "pivoted_stg_support_0" + ], + "alias": "pivoted_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Amounts of stg_support_0 pivoted by status", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "dynamic_columns": [ + { + "name": "status_amounts", + "pivot_column": "status", + "value_column": "amount", + "aggregate": "MAX", + "type": "DOUBLE", + "name_pattern": null + } + ] + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.pivoted_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.pivot_input_stg_support_0" + ] + } + }, + "model.generated_8.unanalysed_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "unanalysed_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/analysis/unanalysed_stg_support_0.sql", + "original_file_path": "models/analysis/unanalysed_stg_support_0.sql", + "unique_id": "model.generated_8.unanalysed_stg_support_0", + "fqn": [ + "generated_8", + "models", + "analysis", + "unanalysed_stg_support_0" + ], + "alias": "unanalysed_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Copy of stg_support_0 that SQL analysis cannot parse", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.unanalysed_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.append_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "append_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/features/append_stg_support_0.sql", + "original_file_path": "models/features/append_stg_support_0.sql", + "unique_id": "model.generated_8.append_stg_support_0", + "fqn": [ + "generated_8", + "models", + "features", + "append_stg_support_0" + ], + "alias": "append_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "append", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Incremental append copy of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.append_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.audited_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "audited_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/features/audited_stg_support_0.sql", + "original_file_path": "models/features/audited_stg_support_0.sql", + "unique_id": "model.generated_8.audited_stg_support_0", + "fqn": [ + "generated_8", + "models", + "features", + "audited_stg_support_0" + ], + "alias": "audited_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Factory-audited copy of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.audited_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.batched_rolling_window_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "batched_rolling_window_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/features/batched_rolling_window_stg_support_0.sql", + "original_file_path": "models/features/batched_rolling_window_stg_support_0.sql", + "unique_id": "model.generated_8.batched_rolling_window_stg_support_0", + "fqn": [ + "generated_8", + "models", + "features", + "batched_rolling_window_stg_support_0" + ], + "alias": "batched_rolling_window_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Microbatched rolling_window totals of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.batched_rolling_window_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.hooked_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "hooked_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/features/hooked_stg_support_0.sql", + "original_file_path": "models/features/hooked_stg_support_0.sql", + "unique_id": "model.generated_8.hooked_stg_support_0", + "fqn": [ + "generated_8", + "models", + "features", + "hooked_stg_support_0" + ], + "alias": "hooked_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Hooked copy of stg_support_0", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "python", + "name": "note_refresh", + "kwargs": { + "channel": "東京 warehouse" + }, + "relative_path": "models/features/_sqlbuild/_hooks/python/notify.py", + "definition_hash": "55440ff19f0c4f231ad57d453227a3c9d584b81234ee4b3338a39ccdf59814a8", + "version_hash": "03b4f786f8ab2736e5be2e4de5016bd16ea44d84beca000ec2a53a397e503eb6" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.hooked_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.product_labels": { + "database": null, + "schema": "ci_checks", + "name": "product_labels", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/features/product_labels.sql", + "original_file_path": "models/features/product_labels.sql", + "unique_id": "model.generated_8.product_labels", + "fqn": [ + "generated_8", + "models", + "features", + "product_labels" + ], + "alias": "product_labels", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Product labels from the loader", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.product_labels", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_8.loaded_products" + ] + } + }, + "model.generated_8.shaped_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "shaped_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/features/shaped_stg_support_0.sql", + "original_file_path": "models/features/shaped_stg_support_0.sql", + "unique_id": "model.generated_8.shaped_stg_support_0", + "fqn": [ + "generated_8", + "models", + "features", + "shaped_stg_support_0" + ], + "alias": "shaped_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Schema-shaped copy of stg_support_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.shaped_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.taxed_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "taxed_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/features/taxed_stg_support_0.sql", + "original_file_path": "models/features/taxed_stg_support_0.sql", + "unique_id": "model.generated_8.taxed_stg_support_0", + "fqn": [ + "generated_8", + "models", + "features", + "taxed_stg_support_0" + ], + "alias": "taxed_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Taxed copy of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.taxed_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.bounded_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "bounded_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/rendering/bounded_stg_support_0.sql", + "original_file_path": "models/rendering/bounded_stg_support_0.sql", + "unique_id": "model.generated_8.bounded_stg_support_0", + "fqn": [ + "generated_8", + "models", + "rendering", + "bounded_stg_support_0" + ], + "alias": "bounded_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Cursor-bounded copy of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.bounded_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.channel_labels": { + "database": null, + "schema": "ci_checks", + "name": "channel_labels", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/rendering/channel_labels.sql", + "original_file_path": "models/rendering/channel_labels.sql", + "unique_id": "model.generated_8.channel_labels", + "fqn": [ + "generated_8", + "models", + "rendering", + "channel_labels" + ], + "alias": "channel_labels", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Normalised channel labels", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.channel_labels", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_8.labelled_channels" + ] + } + }, + "model.generated_8.configured_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "configured_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/rendering/configured_stg_support_0.sql", + "original_file_path": "models/rendering/configured_stg_support_0.sql", + "unique_id": "model.generated_8.configured_stg_support_0", + "fqn": [ + "generated_8", + "models", + "rendering", + "configured_stg_support_0" + ], + "alias": "configured_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "release" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "release" + ], + "description": "Configured copy of stg_support_0 (réglé)", + "columns": { + "id": { + "name": "id", + "description": "Row key", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "Montant réglé", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.configured_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.labelled_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "labelled_stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/rendering/labelled_stg_support_0.sql", + "original_file_path": "models/rendering/labelled_stg_support_0.sql", + "unique_id": "model.generated_8.labelled_stg_support_0", + "fqn": [ + "generated_8", + "models", + "rendering", + "labelled_stg_support_0" + ], + "alias": "labelled_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Labelled copy of stg_support_0", + "columns": { + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.labelled_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.tidy_status", + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.latest_raw_events_1": { + "database": null, + "schema": "ci_checks", + "name": "latest_raw_events_1", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/rendering/latest_raw_events_1.sql", + "original_file_path": "models/rendering/latest_raw_events_1.sql", + "unique_id": "model.generated_8.latest_raw_events_1", + "fqn": [ + "generated_8", + "models", + "rendering", + "latest_raw_events_1" + ], + "alias": "latest_raw_events_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Newest rows of raw_events_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.latest_raw_events_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_8.raw_events_1" + ] + } + }, + "model.generated_8.unioned_event_ids": { + "database": null, + "schema": "ci_checks", + "name": "unioned_event_ids", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/rendering/unioned_event_ids.sql", + "original_file_path": "models/rendering/unioned_event_ids.sql", + "unique_id": "model.generated_8.unioned_event_ids", + "fqn": [ + "generated_8", + "models", + "rendering", + "unioned_event_ids" + ], + "alias": "unioned_event_ids", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Ids from two staged relations", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.unioned_event_ids", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.support_summary_0": { + "database": null, + "schema": "ci_checks", + "name": "support_summary_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/support/marts/support_summary_0.sql", + "original_file_path": "models/support/marts/support_summary_0.sql", + "unique_id": "model.generated_8.support_summary_0", + "fqn": [ + "generated_8", + "models", + "support", + "marts", + "support_summary_0" + ], + "alias": "support_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'ci_checks.support_summary_0' AS refreshed_relation, 'naïve résumé' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'ci_checks.support_summary_0' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of support activity 0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'ci_checks.support_summary_0' AS refreshed_relation, 'naïve résumé' AS refresh_label", + "name": "record_refresh", + "relative_path": "models/support/marts/_sqlbuild/_hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "naïve résumé" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'ci_checks.support_summary_0' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.support_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.support_summary_1": { + "database": null, + "schema": "ci_checks", + "name": "support_summary_1", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/support/marts/support_summary_1.sql", + "original_file_path": "models/support/marts/support_summary_1.sql", + "unique_id": "model.generated_8.support_summary_1", + "fqn": [ + "generated_8", + "models", + "support", + "marts", + "support_summary_1" + ], + "alias": "support_summary_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'ci_checks.support_summary_1' AS refreshed_relation, '東京 warehouse' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'ci_checks.support_summary_1' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of support activity 1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'ci_checks.support_summary_1' AS refreshed_relation, '東京 warehouse' AS refresh_label", + "name": "record_refresh", + "relative_path": "models/support/marts/_sqlbuild/_hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "東京 warehouse" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'ci_checks.support_summary_1' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.support_summary_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.support_summary_2": { + "database": null, + "schema": "ci_checks", + "name": "support_summary_2", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/support/marts/support_summary_2.sql", + "original_file_path": "models/support/marts/support_summary_2.sql", + "unique_id": "model.generated_8.support_summary_2", + "fqn": [ + "generated_8", + "models", + "support", + "marts", + "support_summary_2" + ], + "alias": "support_summary_2", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'ci_checks.support_summary_2' AS refreshed_relation, 'Zürich – depot' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'ci_checks.support_summary_2' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of support activity 2", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'ci_checks.support_summary_2' AS refreshed_relation, 'Zürich – depot' AS refresh_label", + "name": "record_refresh", + "relative_path": "models/support/marts/_sqlbuild/_hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "Zürich – depot" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'ci_checks.support_summary_2' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.support_summary_2", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_8.stg_support_0" + ] + } + }, + "model.generated_8.stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "stg_support_0", + "resource_type": "model", + "package_name": "generated_8", + "path": "models/support/staging/stg_support_0.sql", + "original_file_path": "models/support/staging/stg_support_0.sql", + "unique_id": "model.generated_8.stg_support_0", + "fqn": [ + "generated_8", + "models", + "support", + "staging", + "stg_support_0" + ], + "alias": "stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged support events 0 (東京 warehouse)", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_8.raw_events_0" + ] + } + } + }, + "sources": { + "source.generated_8.configured_events": { + "database": null, + "schema": "", + "name": "configured_events", + "resource_type": "source", + "package_name": "generated_8", + "path": "sources/configured.yml", + "original_file_path": "sources/configured.yml", + "unique_id": "source.generated_8.configured_events", + "fqn": [ + "generated_8", + "configured_events" + ], + "source_name": "configured_events", + "source_description": "", + "loader": "", + "identifier": "configured_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Configured feed events", + "columns": { + "id": { + "name": "id", + "description": "Key id", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "owner": "orders team" + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_8.labelled_channels": { + "database": null, + "schema": "", + "name": "labelled_channels", + "resource_type": "source", + "package_name": "generated_8", + "path": "sources/labelled.yml", + "original_file_path": "sources/labelled.yml", + "unique_id": "source.generated_8.labelled_channels", + "fqn": [ + "generated_8", + "labelled_channels" + ], + "source_name": "labelled_channels", + "source_description": "", + "loader": "", + "identifier": "labelled_channels", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Channel labels normalised in the source expression.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "channel": { + "name": "channel", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_8.loaded_products": { + "database": null, + "schema": "ci_checks", + "name": "loaded_products", + "resource_type": "source", + "package_name": "generated_8", + "path": "sources/managed.yml", + "original_file_path": "sources/managed.yml", + "unique_id": "source.generated_8.loaded_products", + "fqn": [ + "generated_8", + "loaded_products" + ], + "source_name": "loaded_products", + "source_description": "", + "loader": "", + "identifier": "loaded_products", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Products loaded by a project loader.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "loaded_products", + "auto_load": false, + "write_strategy": "table" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_8.raw_events_0": { + "database": null, + "schema": "", + "name": "raw_events_0", + "resource_type": "source", + "package_name": "generated_8", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_8.raw_events_0", + "fqn": [ + "generated_8", + "raw_events_0" + ], + "source_name": "raw_events_0", + "source_description": "", + "loader": "", + "identifier": "raw_events_0", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_8.raw_events_1": { + "database": null, + "schema": "", + "name": "raw_events_1", + "resource_type": "source", + "package_name": "generated_8", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_8.raw_events_1", + "fqn": [ + "generated_8", + "raw_events_1" + ], + "source_name": "raw_events_1", + "source_description": "", + "loader": "", + "identifier": "raw_events_1", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 1.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.generated_8.tidy_label": { + "name": "tidy_label", + "resource_type": "macro", + "package_name": "generated_8", + "path": "macros/labels.py", + "original_file_path": "macros/labels.py", + "unique_id": "macro.generated_8.tidy_label", + "macro_sql": "def tidy_label(expression: str) -> str:\n \"\"\"Trim and lower-case a label.\"\"\"\n return f\"LOWER(TRIM({expression}))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_8.round_amount": { + "name": "round_amount", + "resource_type": "macro", + "package_name": "generated_8", + "path": "macros/rounding.py", + "original_file_path": "macros/rounding.py", + "unique_id": "macro.generated_8.round_amount", + "macro_sql": "def round_amount(expression: str, places: int = 2) -> str:\n \"\"\"Round an amount.\"\"\"\n return f\"ROUND({expression}, {places})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_8.taxed": { + "name": "taxed", + "resource_type": "macro", + "package_name": "generated_8", + "path": "macros/tax.py", + "original_file_path": "macros/tax.py", + "unique_id": "macro.generated_8.taxed", + "macro_sql": "from macros.rounding import round_amount\n\n\ndef taxed(expression: str) -> str:\n \"\"\"Add tax to an amount, rounded.\"\"\"\n return round_amount(f\"{expression} * 1.2\")\n", + "depends_on": { + "macros": [ + "macro.generated_8.round_amount" + ] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_8.latest_rows": { + "name": "latest_rows", + "resource_type": "macro", + "package_name": "generated_8", + "path": "models/rendering/_sqlbuild/_macros/relations.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/relations.py", + "unique_id": "macro.generated_8.latest_rows", + "macro_sql": "from sqlbuild.refs import SqlResourceRef\n\n\ndef union_ids(relations: list[SqlResourceRef]) -> str:\n \"\"\"Union the ids of several relations.\"\"\"\n selects = [f\"SELECT id FROM {relation}\" for relation in relations]\n return \" UNION ALL \".join(selects)\n\n\ndef latest_rows(relation: SqlResourceRef, limit: int = 2) -> str:\n \"\"\"Return the newest rows of one relation.\"\"\"\n return f\"(SELECT id, amount FROM {relation} ORDER BY id DESC LIMIT {limit})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_8.union_ids": { + "name": "union_ids", + "resource_type": "macro", + "package_name": "generated_8", + "path": "models/rendering/_sqlbuild/_macros/relations.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/relations.py", + "unique_id": "macro.generated_8.union_ids", + "macro_sql": "from sqlbuild.refs import SqlResourceRef\n\n\ndef union_ids(relations: list[SqlResourceRef]) -> str:\n \"\"\"Union the ids of several relations.\"\"\"\n selects = [f\"SELECT id FROM {relation}\" for relation in relations]\n return \" UNION ALL \".join(selects)\n\n\ndef latest_rows(relation: SqlResourceRef, limit: int = 2) -> str:\n \"\"\"Return the newest rows of one relation.\"\"\"\n return f\"(SELECT id, amount FROM {relation} ORDER BY id DESC LIMIT {limit})\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_8.adjust_1": { + "name": "adjust_1", + "resource_type": "macro", + "package_name": "generated_8", + "path": "models/support/_sqlbuild/macros/adjust_1.py", + "original_file_path": "models/support/_sqlbuild/macros/adjust_1.py", + "unique_id": "macro.generated_8.adjust_1", + "macro_sql": "import os\n\n\ndef adjust_1(expression: str) -> str:\n \"\"\"Tag an amount with the deployment region.\"\"\"\n region = os.environ.get(\"SQB_DIFFERENTIAL_REGION\", \"east\")\n return f\"({expression} + LENGTH('{region}'))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "inherited", + "sqlbuild_scope_path": "models/support" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_8.adjust_2": { + "name": "adjust_2", + "resource_type": "macro", + "package_name": "generated_8", + "path": "models/support/_sqlbuild/macros/adjust_2.py", + "original_file_path": "models/support/_sqlbuild/macros/adjust_2.py", + "unique_id": "macro.generated_8.adjust_2", + "macro_sql": "def adjust_2(expression: str) -> str:\n \"\"\"Offset an amount.\"\"\"\n return f\"({expression} + 2 + 1)\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "inherited", + "sqlbuild_scope_path": "models/support" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_8.adjust_0": { + "name": "adjust_0", + "resource_type": "macro", + "package_name": "generated_8", + "path": "models/support/marts/_sqlbuild/_macros/adjust_0.py", + "original_file_path": "models/support/marts/_sqlbuild/_macros/adjust_0.py", + "unique_id": "macro.generated_8.adjust_0", + "macro_sql": "def adjust_0(ctx, expression: str) -> str:\n \"\"\"Scale an amount by the configured discount.\"\"\"\n rate = ctx.vars[\"discount_rate\"]\n return f\"({expression} * (1 - {rate}))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/support/marts" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_8.doubled": { + "name": "doubled", + "resource_type": "macro", + "package_name": "generated_8", + "path": "tests/unit/_macros/scaling.py", + "original_file_path": "tests/unit/_macros/scaling.py", + "unique_id": "macro.generated_8.doubled", + "macro_sql": "def doubled(expression: str) -> str:\n \"\"\"Double an amount.\"\"\"\n return f\"({expression} * 2)\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "tests/unit" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_8.event_rows": { + "name": "event_rows", + "resource_type": "macro", + "package_name": "generated_8", + "path": "tests/unit/rendering/_sqlbuild/_macros/fixtures.py", + "original_file_path": "tests/unit/rendering/_sqlbuild/_macros/fixtures.py", + "unique_id": "macro.generated_8.event_rows", + "macro_sql": "def event_rows(count: int = 2) -> str:\n \"\"\"Return fixture event rows.\"\"\"\n return \" UNION ALL \".join(\n f\"SELECT {index} AS id, CAST({index} AS DOUBLE) AS amount, \"\n f\"'placed' AS status, \"\n f\"TIMESTAMP '2026-01-0{index} 00:00:00' AS created_at\"\n for index in range(1, count + 1)\n )\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "tests/unit/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_8__sqlbuild_hooks.record_refresh": { + "name": "record_refresh", + "resource_type": "macro", + "package_name": "generated_8__sqlbuild_hooks", + "path": "models/support/marts/_sqlbuild/_hooks/sql/record_refresh.sql", + "original_file_path": "models/support/marts/_sqlbuild/_hooks/sql/record_refresh.sql", + "unique_id": "macro.generated_8__sqlbuild_hooks.record_refresh", + "macro_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "depends_on": { + "macros": [] + }, + "description": "Record a refresh for one relation", + "meta": { + "sqlbuild_resource_type": "sql_hook", + "sqlbuild_hook_name": "record_refresh" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.generated_8.checked_stg_support_0": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.pivot_input_stg_support_0": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.pivoted_stg_support_0": [ + "model.generated_8.pivot_input_stg_support_0" + ], + "model.generated_8.unanalysed_stg_support_0": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.append_stg_support_0": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.audited_stg_support_0": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.batched_rolling_window_stg_support_0": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.hooked_stg_support_0": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.product_labels": [ + "source.generated_8.loaded_products" + ], + "model.generated_8.shaped_stg_support_0": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.taxed_stg_support_0": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.bounded_stg_support_0": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.channel_labels": [ + "source.generated_8.labelled_channels" + ], + "model.generated_8.configured_stg_support_0": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.labelled_stg_support_0": [ + "model.generated_8.tidy_status", + "model.generated_8.stg_support_0" + ], + "model.generated_8.latest_raw_events_1": [ + "source.generated_8.raw_events_1" + ], + "model.generated_8.unioned_event_ids": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.support_summary_0": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.support_summary_1": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.support_summary_2": [ + "model.generated_8.stg_support_0" + ], + "model.generated_8.stg_support_0": [ + "source.generated_8.raw_events_0" + ], + "source.generated_8.configured_events": [], + "source.generated_8.labelled_channels": [], + "source.generated_8.loaded_products": [], + "source.generated_8.raw_events_0": [], + "source.generated_8.raw_events_1": [], + "model.generated_8.configured_label": [], + "model.generated_8.tidy_status": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/seed/9.json b/tests/goldens/compiler/seed/9.json new file mode 100644 index 0000000000..cf030399cf --- /dev/null +++ b/tests/goldens/compiler/seed/9.json @@ -0,0 +1,3210 @@ +{ + "commands": [ + { + "label": "compile", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "compile-store-warm", + "exit_code": 0, + "diagnostics": [] + }, + { + "label": "plan", + "exit_code": 0, + "diagnostics": [] + } + ], + "compiled": { + "audits/generic/billing_summary_0/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"billing_summary_0\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/configured_events/accepted_values__id.sql": [ + "SELECT id", + "FROM __source(\"configured_events\")", + "WHERE id IS NOT NULL", + " AND id NOT IN ('1')", + "" + ], + "audits/generic/configured_stg_support_1/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"configured_stg_support_1\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'shipped')", + "" + ], + "audits/generic/configured_stg_support_1/configured_amount_floor.sql": [ + "SELECT *", + "FROM __ref(\"configured_stg_support_1\")", + "WHERE amount < -37", + "" + ], + "audits/generic/configured_stg_support_1/configured_id_present__id.sql": [ + "SELECT id", + "FROM __ref(\"configured_stg_support_1\")", + "WHERE id IS NULL", + "" + ], + "audits/generic/configured_stg_support_1/unique__id.sql": [ + "SELECT id, COUNT(*) AS duplicate_count", + "FROM __ref(\"configured_stg_support_1\")", + "WHERE id IS NOT NULL", + "GROUP BY id", + "HAVING COUNT(*) > 1", + "" + ], + "audits/generic/guarded_stg_billing_0/amount_at_least__amount.sql": [ + "SELECT *", + "FROM __ref(\"guarded_stg_billing_0\")", + "WHERE amount < 0", + "" + ], + "audits/generic/labelled_stg_support_1/tidy_status__status.sql": [ + "SELECT *", + "FROM __ref(\"labelled_stg_support_1\")", + "WHERE status <> LOWER(TRIM(status))", + "" + ], + "audits/generic/stated_stg_support_0/accepted_values__status.sql": [ + "SELECT status", + "FROM __ref(\"stated_stg_support_0\")", + "WHERE status IS NOT NULL", + " AND status NOT IN ('placed', 'expédié', '取消', 'returned ✓')", + "" + ], + "audits/generic/stg_support_1/not_null__id.sql": [ + "SELECT id", + "FROM __ref(\"stg_support_1\")", + "WHERE id IS NULL", + "" + ], + "audits/singular/labelled_channels_match.sql": [ + "SELECT l.id", + "FROM __ref(\"labelled_stg_support_1\") l", + "JOIN __ref(\"channel_labels\") c ON l.id = c.id", + "WHERE l.status = c.channel", + "" + ], + "functions/python/is_large.sql": [ + "REGISTER PYTHON FUNCTION is_large(DOUBLE) RETURNS BOOLEAN", + "" + ], + "functions/sql/configured_label.sql": [ + "CREATE OR REPLACE MACRO ci_checks.configured_label(raw_status) AS (", + "UPPER(raw_status)", + ")", + "" + ], + "functions/sql/is_placed.sql": [ + "CREATE OR REPLACE MACRO ci_checks.is_placed(event_status) AS (", + "event_status = 'placed'", + ")", + "" + ], + "functions/sql/tidy_status.sql": [ + "CREATE OR REPLACE MACRO ci_checks.tidy_status(raw_status) AS (", + "LOWER(TRIM(raw_status))", + ")", + "" + ], + "models/analysis/combined_stg_billing_0.sql": [ + "WITH recent AS (", + " SELECT id, created_at FROM __ref(\"stg_billing_0\") WHERE amount > 0", + "),", + "older AS (", + " SELECT id, created_at FROM __ref(\"stg_support_0\")", + ")", + "SELECT id, created_at FROM recent", + "UNION ALL", + "SELECT id, created_at FROM older", + "" + ], + "models/analysis/every_open_event.sql": [ + "SELECT *", + "FROM __source(\"open_events\")", + "" + ], + "models/analysis/every_raw_events_1.sql": [ + "SELECT *", + "FROM __source(\"raw_events_1\")", + "" + ], + "models/analysis/every_stg_billing_0.sql": [ + "SELECT *", + "FROM __ref(\"stg_billing_0\")", + "" + ], + "models/analysis/passed_stg_billing_0.sql": [ + "WITH passthrough AS (", + " SELECT id, created_at FROM __ref(\"stg_billing_0\")", + ")", + "SELECT id, created_at", + "FROM passthrough", + "" + ], + "models/analysis/pivot_input_stg_support_0.sql": [ + "SELECT CAST(id AS INTEGER) AS id, CAST(status AS VARCHAR) AS status, amount", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/analysis/pivoted_stg_support_0.sql": [ + "PIVOT __ref(\"pivot_input_stg_support_0\")", + "ON status", + "USING MAX(amount)", + "GROUP BY id", + "" + ], + "models/analysis/quoted_stg_support_0.sql": [ + "SELECT \"ID\" AS \"OrderKey\", \"Amount\", \"Status\" AS \"Status\"", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/analysis/typed_stg_billing_0.sql": [ + "SELECT id, amount * 2 AS doubled_amount, CAST(status AS VARCHAR) AS status_text,", + " created_at, NULL AS missing_note", + "FROM __ref(\"stg_billing_0\")", + "" + ], + "models/analysis/unanalysed_stg_support_1.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_support_1\")", + "WHERE id = ANY [1, 2]", + "" + ], + "models/billing/marts/billing_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * 2.4700 AS threshold_0_amount", + "FROM __ref(\"stg_billing_0\") t", + "WHERE t.status <> 'placed'", + "" + ], + "models/billing/staging/stg_billing_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * 2.4700 AS threshold_0_amount,", + " (t.amount + 0 + 1) AS adjust_0_amount,", + " 'Zürich – depot' AS site_label", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/features/append_stg_support_0.sql": [ + "SELECT id, amount, status, created_at", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/features/batched_rolling_window_stg_support_1.sql": [ + "SELECT CAST(created_at AS DATE) AS created_at, SUM(amount) AS amount", + "FROM __ref(\"stg_support_1\")", + "GROUP BY CAST(created_at AS DATE)", + "" + ], + "models/features/delete_insert_stg_billing_0.sql": [ + "SELECT id, amount, status, created_at", + "FROM __ref(\"stg_billing_0\")", + "" + ], + "models/features/flagged_stg_billing_0.sql": [ + "SELECT id, __udf(\"is_placed\")(status) AS is_placed,", + " __udf(\"is_large\")(amount) AS is_large", + "FROM __ref(\"stg_billing_0\")", + "" + ], + "models/features/guarded_stg_billing_0.sql": [ + "SELECT id, amount", + "FROM __ref(\"stg_billing_0\")", + "" + ], + "models/features/kept_stg_support_1.sql": [ + "SELECT id, status, amount * 0.5 AS weighted", + "FROM __ref(\"stg_support_1\")", + "WHERE status IN ('取消', 'placed')", + " AND amount * 1.0 IN (0.5, 1.25, 2500.75) OR id > 0", + "" + ], + "models/features/product_labels.sql": [ + "SELECT id, label", + "FROM __source(\"loaded_products\")", + "" + ], + "models/features/spaced_stg_support_0.sql": [ + "-- Généré pour café ☕ counter", + "SELECT", + "\tid,", + "\t'Zürich – depot' AS label, -- étiquette ✓", + "\tamount", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/features/timestamp_history_stg_support_1.sql": [ + "SELECT id, status, created_at", + "FROM __ref(\"stg_support_1\")", + "" + ], + "models/rendering/channel_labels.sql": [ + "SELECT id, channel", + "FROM __source(\"labelled_channels\")", + "" + ], + "models/rendering/configured_stg_support_1.sql": [ + "SELECT id, amount, status", + "FROM __ref(\"stg_support_1\")", + "" + ], + "models/rendering/labelled_stg_support_1.sql": [ + "SELECT id, LOWER(TRIM(status)) AS status,", + " __udf(\"tidy_status\")(status) AS tidied", + "FROM __ref(\"stg_support_1\")", + "" + ], + "models/rendering/legacy_event_ids.sql": [ + "SELECT id", + "FROM __ref(\"stg_support_0\") AS legacy", + "" + ], + "models/rendering/stated_stg_support_0.sql": [ + "SELECT CAST(id AS INTEGER) AS id, status,", + " CASE WHEN amount >= 2 THEN 'HIGH'", + " ELSE 'LOW' END AS tier", + "FROM __ref(\"stg_support_0\")", + "" + ], + "models/support/marts/support_summary_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " 'Zürich – depot' AS site_label", + "FROM __ref(\"stg_support_0\") t", + "" + ], + "models/support/staging/stg_support_0.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * 2.4700 AS threshold_0_amount", + "FROM __source(\"raw_events_0\") t", + "" + ], + "models/support/staging/stg_support_1.sql": [ + "SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount + 0 + 1) AS adjust_0_amount", + "FROM __source(\"raw_events_0\") t", + "" + ], + "tests/_chain_/labelled_stg_support_1__stg_support_1/test_labelled_stg_support_1.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(1 AS DOUBLE) AS amount, 'placed' AS status, TIMESTAMP '2026-01-01 00:00:00' AS created_at UNION ALL SELECT 2 AS id, CAST(2 AS DOUBLE) AS amount, 'placed' AS status, TIMESTAMP '2026-01-02 00:00:00' AS created_at),", + "__ref__stg_support_1 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " (t.amount + 0 + 1) AS adjust_0_amount", + "FROM __source__raw_events_0 t),", + "__ref__labelled_stg_support_1 AS (SELECT id, LOWER(TRIM(status)) AS status,", + " ci_checks.tidy_status(status) AS tidied", + "FROM __ref__stg_support_1),", + "__actual__labelled_stg_support_1 AS (SELECT * FROM __ref__labelled_stg_support_1),", + "__expected__labelled_stg_support_1 AS (SELECT 1 AS id, LOWER(TRIM('placed')) AS status", + " UNION ALL", + " SELECT 2 AS id, 'placed' AS status)", + "SELECT 1 AS step_index, 'labelled_stg_support_1' AS model_name, (SELECT COUNT(*) FROM __actual__labelled_stg_support_1) AS actual_count, (SELECT COUNT(*) FROM __expected__labelled_stg_support_1) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __actual__labelled_stg_support_1 EXCEPT SELECT id, status FROM __expected__labelled_stg_support_1) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __expected__labelled_stg_support_1 EXCEPT SELECT id, status FROM __actual__labelled_stg_support_1) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/stg_support_0/test_stg_support_0.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(10 AS DOUBLE) AS amount, 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_support_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * 2.4700 AS threshold_0_amount", + "FROM __source__raw_events_0 t),", + "__actual__stg_support_0 AS (SELECT * FROM __ref__stg_support_0),", + "__expected__stg_support_0 AS (SELECT 1 AS id, 'placed' AS status)", + "SELECT 0 AS step_index, 'stg_support_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_support_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_support_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __actual__stg_support_0 EXCEPT SELECT id, status FROM __expected__stg_support_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id, status FROM __expected__stg_support_0 EXCEPT SELECT id, status FROM __actual__stg_support_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/tests/unit/test_stg_support_0_cases/block_1__labelled.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(2.25 AS DOUBLE) AS amount,", + " 'Zürich – depot' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_support_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * 2.4700 AS threshold_0_amount", + "FROM __source__raw_events_0 t),", + "__actual__stg_support_0 AS (SELECT * FROM __ref__stg_support_0),", + "__expected__stg_support_0 AS (SELECT 1 AS id)", + "SELECT 0 AS step_index, 'stg_support_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_support_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_support_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id FROM __actual__stg_support_0 EXCEPT SELECT id FROM __expected__stg_support_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id FROM __expected__stg_support_0 EXCEPT SELECT id FROM __actual__stg_support_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/tests/unit/test_stg_support_0_cases/block_1__placed.sql": [ + "WITH __source__raw_events_0 AS (SELECT 1 AS id, CAST(1.5 AS DOUBLE) AS amount,", + " 'placed' AS status,", + " TIMESTAMP '2026-01-01 00:00:00' AS created_at),", + "__ref__stg_support_0 AS (SELECT", + " t.id,", + " t.amount,", + " t.status,", + " t.created_at,", + " t.amount * 2.4700 AS threshold_0_amount", + "FROM __source__raw_events_0 t),", + "__actual__stg_support_0 AS (SELECT * FROM __ref__stg_support_0),", + "__expected__stg_support_0 AS (SELECT 1 AS id)", + "SELECT 0 AS step_index, 'stg_support_0' AS model_name, (SELECT COUNT(*) FROM __actual__stg_support_0) AS actual_count, (SELECT COUNT(*) FROM __expected__stg_support_0) AS expected_count, (SELECT COUNT(*) FROM (SELECT id FROM __actual__stg_support_0 EXCEPT SELECT id FROM __expected__stg_support_0) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT id FROM __expected__stg_support_0 EXCEPT SELECT id FROM __actual__stg_support_0) AS __sqlbuild_missing) AS missing_count", + "" + ], + "tests/udf detects_placed_events/detects_placed_events.sql": [ + "WITH input_values AS (SELECT 'placed' AS event_status),", + "__actual__udf_detects_placed_events AS (SELECT event_status, ci_checks.is_placed(event_status) AS is_placed", + " FROM input_values),", + "__expected__udf_detects_placed_events AS (SELECT 'placed' AS event_status, TRUE AS is_placed)", + "SELECT 0 AS step_index, 'udf detects_placed_events' AS model_name, (SELECT COUNT(*) FROM __actual__udf_detects_placed_events) AS actual_count, (SELECT COUNT(*) FROM __expected__udf_detects_placed_events) AS expected_count, (SELECT COUNT(*) FROM (SELECT * FROM __actual__udf_detects_placed_events EXCEPT SELECT * FROM __expected__udf_detects_placed_events) AS __sqlbuild_mismatch) AS unexpected_count, (SELECT COUNT(*) FROM (SELECT * FROM __expected__udf_detects_placed_events EXCEPT SELECT * FROM __actual__udf_detects_placed_events) AS __sqlbuild_missing) AS missing_count", + "" + ] + }, + "manifest": { + "nodes": { + "model.generated_9.combined_stg_billing_0": { + "database": null, + "schema": "ci_checks", + "name": "combined_stg_billing_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/analysis/combined_stg_billing_0.sql", + "original_file_path": "models/analysis/combined_stg_billing_0.sql", + "unique_id": "model.generated_9.combined_stg_billing_0", + "fqn": [ + "generated_9", + "models", + "analysis", + "combined_stg_billing_0" + ], + "alias": "combined_stg_billing_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Recent and older rows of stg_billing_0 and stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.combined_stg_billing_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_billing_0", + "model.generated_9.stg_support_0" + ] + } + }, + "model.generated_9.every_open_event": { + "database": null, + "schema": "ci_checks", + "name": "every_open_event", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/analysis/every_open_event.sql", + "original_file_path": "models/analysis/every_open_event.sql", + "unique_id": "model.generated_9.every_open_event", + "fqn": [ + "generated_9", + "models", + "analysis", + "every_open_event" + ], + "alias": "every_open_event", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Every column of an open source", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.every_open_event", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_9.open_events" + ] + } + }, + "model.generated_9.every_raw_events_1": { + "database": null, + "schema": "ci_checks", + "name": "every_raw_events_1", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/analysis/every_raw_events_1.sql", + "original_file_path": "models/analysis/every_raw_events_1.sql", + "unique_id": "model.generated_9.every_raw_events_1", + "fqn": [ + "generated_9", + "models", + "analysis", + "every_raw_events_1" + ], + "alias": "every_raw_events_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Every column of raw_events_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.every_raw_events_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_9.raw_events_1" + ] + } + }, + "model.generated_9.every_stg_billing_0": { + "database": null, + "schema": "ci_checks", + "name": "every_stg_billing_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/analysis/every_stg_billing_0.sql", + "original_file_path": "models/analysis/every_stg_billing_0.sql", + "unique_id": "model.generated_9.every_stg_billing_0", + "fqn": [ + "generated_9", + "models", + "analysis", + "every_stg_billing_0" + ], + "alias": "every_stg_billing_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Every column of stg_billing_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.every_stg_billing_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_billing_0" + ] + } + }, + "model.generated_9.passed_stg_billing_0": { + "database": null, + "schema": "ci_checks", + "name": "passed_stg_billing_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/analysis/passed_stg_billing_0.sql", + "original_file_path": "models/analysis/passed_stg_billing_0.sql", + "unique_id": "model.generated_9.passed_stg_billing_0", + "fqn": [ + "generated_9", + "models", + "analysis", + "passed_stg_billing_0" + ], + "alias": "passed_stg_billing_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Columns of stg_billing_0 passed through a CTE", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.passed_stg_billing_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_billing_0" + ] + } + }, + "model.generated_9.pivot_input_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "pivot_input_stg_support_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/analysis/pivot_input_stg_support_0.sql", + "original_file_path": "models/analysis/pivot_input_stg_support_0.sql", + "unique_id": "model.generated_9.pivot_input_stg_support_0", + "fqn": [ + "generated_9", + "models", + "analysis", + "pivot_input_stg_support_0" + ], + "alias": "pivot_input_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Contracted pivot input from stg_support_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.pivot_input_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_support_0" + ] + } + }, + "model.generated_9.pivoted_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "pivoted_stg_support_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/analysis/pivoted_stg_support_0.sql", + "original_file_path": "models/analysis/pivoted_stg_support_0.sql", + "unique_id": "model.generated_9.pivoted_stg_support_0", + "fqn": [ + "generated_9", + "models", + "analysis", + "pivoted_stg_support_0" + ], + "alias": "pivoted_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Amounts of stg_support_0 pivoted by status", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "dynamic_columns": [ + { + "name": "status_amounts", + "pivot_column": "status", + "value_column": "amount", + "aggregate": "MAX", + "type": "DOUBLE", + "name_pattern": null + } + ] + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.pivoted_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.pivot_input_stg_support_0" + ] + } + }, + "model.generated_9.quoted_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "quoted_stg_support_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/analysis/quoted_stg_support_0.sql", + "original_file_path": "models/analysis/quoted_stg_support_0.sql", + "unique_id": "model.generated_9.quoted_stg_support_0", + "fqn": [ + "generated_9", + "models", + "analysis", + "quoted_stg_support_0" + ], + "alias": "quoted_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Quoted identifiers over stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.quoted_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_support_0" + ] + } + }, + "model.generated_9.typed_stg_billing_0": { + "database": null, + "schema": "ci_checks", + "name": "typed_stg_billing_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/analysis/typed_stg_billing_0.sql", + "original_file_path": "models/analysis/typed_stg_billing_0.sql", + "unique_id": "model.generated_9.typed_stg_billing_0", + "fqn": [ + "generated_9", + "models", + "analysis", + "typed_stg_billing_0" + ], + "alias": "typed_stg_billing_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Typed and untyped outputs of stg_billing_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.typed_stg_billing_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_billing_0" + ] + } + }, + "model.generated_9.unanalysed_stg_support_1": { + "database": null, + "schema": "ci_checks", + "name": "unanalysed_stg_support_1", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/analysis/unanalysed_stg_support_1.sql", + "original_file_path": "models/analysis/unanalysed_stg_support_1.sql", + "unique_id": "model.generated_9.unanalysed_stg_support_1", + "fqn": [ + "generated_9", + "models", + "analysis", + "unanalysed_stg_support_1" + ], + "alias": "unanalysed_stg_support_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Copy of stg_support_1 that SQL analysis cannot parse", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.unanalysed_stg_support_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_support_1" + ] + } + }, + "model.generated_9.billing_summary_0": { + "database": null, + "schema": "ci_checks", + "name": "billing_summary_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/billing/marts/billing_summary_0.sql", + "original_file_path": "models/billing/marts/billing_summary_0.sql", + "unique_id": "model.generated_9.billing_summary_0", + "fqn": [ + "generated_9", + "models", + "billing", + "marts", + "billing_summary_0" + ], + "alias": "billing_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'ci_checks.billing_summary_0' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'ci_checks.billing_summary_0' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Summary of billing activity 0 (Zürich – depot)", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'ci_checks.billing_summary_0' AS refreshed_relation, 'Ελληνικά orders' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "Ελληνικά orders" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'ci_checks.billing_summary_0' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.billing_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_billing_0" + ] + } + }, + "model.generated_9.stg_billing_0": { + "database": null, + "schema": "ci_checks", + "name": "stg_billing_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/billing/staging/stg_billing_0.sql", + "original_file_path": "models/billing/staging/stg_billing_0.sql", + "unique_id": "model.generated_9.stg_billing_0", + "fqn": [ + "generated_9", + "models", + "billing", + "staging", + "stg_billing_0" + ], + "alias": "stg_billing_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged billing events 0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.stg_billing_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_9.raw_events_0" + ] + } + }, + "model.generated_9.append_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "append_stg_support_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/features/append_stg_support_0.sql", + "original_file_path": "models/features/append_stg_support_0.sql", + "unique_id": "model.generated_9.append_stg_support_0", + "fqn": [ + "generated_9", + "models", + "features", + "append_stg_support_0" + ], + "alias": "append_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "append", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Incremental append copy of stg_support_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.append_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_support_0" + ] + } + }, + "model.generated_9.batched_rolling_window_stg_support_1": { + "database": null, + "schema": "ci_checks", + "name": "batched_rolling_window_stg_support_1", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/features/batched_rolling_window_stg_support_1.sql", + "original_file_path": "models/features/batched_rolling_window_stg_support_1.sql", + "unique_id": "model.generated_9.batched_rolling_window_stg_support_1", + "fqn": [ + "generated_9", + "models", + "features", + "batched_rolling_window_stg_support_1" + ], + "alias": "batched_rolling_window_stg_support_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Microbatched rolling_window totals of stg_support_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.batched_rolling_window_stg_support_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_support_1" + ] + } + }, + "model.generated_9.delete_insert_stg_billing_0": { + "database": null, + "schema": "ci_checks", + "name": "delete_insert_stg_billing_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/features/delete_insert_stg_billing_0.sql", + "original_file_path": "models/features/delete_insert_stg_billing_0.sql", + "unique_id": "model.generated_9.delete_insert_stg_billing_0", + "fqn": [ + "generated_9", + "models", + "features", + "delete_insert_stg_billing_0" + ], + "alias": "delete_insert_stg_billing_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "incremental", + "incremental_strategy": "delete_insert", + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Incremental delete_insert copy of stg_billing_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.delete_insert_stg_billing_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_billing_0" + ] + } + }, + "model.generated_9.flagged_stg_billing_0": { + "database": null, + "schema": "ci_checks", + "name": "flagged_stg_billing_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/features/flagged_stg_billing_0.sql", + "original_file_path": "models/features/flagged_stg_billing_0.sql", + "unique_id": "model.generated_9.flagged_stg_billing_0", + "fqn": [ + "generated_9", + "models", + "features", + "flagged_stg_billing_0" + ], + "alias": "flagged_stg_billing_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Function-flagged copy of stg_billing_0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.flagged_stg_billing_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.is_placed", + "model.generated_9.is_large", + "model.generated_9.stg_billing_0" + ] + } + }, + "model.generated_9.guarded_stg_billing_0": { + "database": null, + "schema": "ci_checks", + "name": "guarded_stg_billing_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/features/guarded_stg_billing_0.sql", + "original_file_path": "models/features/guarded_stg_billing_0.sql", + "unique_id": "model.generated_9.guarded_stg_billing_0", + "fqn": [ + "generated_9", + "models", + "features", + "guarded_stg_billing_0" + ], + "alias": "guarded_stg_billing_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Generic-audited copy of stg_billing_0", + "columns": { + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.guarded_stg_billing_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_billing_0" + ] + } + }, + "model.generated_9.kept_stg_support_1": { + "database": null, + "schema": "ci_checks", + "name": "kept_stg_support_1", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/features/kept_stg_support_1.sql", + "original_file_path": "models/features/kept_stg_support_1.sql", + "unique_id": "model.generated_9.kept_stg_support_1", + "fqn": [ + "generated_9", + "models", + "features", + "kept_stg_support_1" + ], + "alias": "kept_stg_support_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Statuses kept from stg_support_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.kept_stg_support_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_support_1" + ] + } + }, + "model.generated_9.product_labels": { + "database": null, + "schema": "ci_checks", + "name": "product_labels", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/features/product_labels.sql", + "original_file_path": "models/features/product_labels.sql", + "unique_id": "model.generated_9.product_labels", + "fqn": [ + "generated_9", + "models", + "features", + "product_labels" + ], + "alias": "product_labels", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Product labels from the loader", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.product_labels", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_9.loaded_products" + ] + } + }, + "model.generated_9.spaced_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "spaced_stg_support_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/features/spaced_stg_support_0.sql", + "original_file_path": "models/features/spaced_stg_support_0.sql", + "unique_id": "model.generated_9.spaced_stg_support_0", + "fqn": [ + "generated_9", + "models", + "features", + "spaced_stg_support_0" + ], + "alias": "spaced_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "línea", + "東京" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "línea", + "東京" + ], + "description": "Copy of stg_support_0 with café ☕ counter", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.spaced_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_support_0" + ] + } + }, + "model.generated_9.timestamp_history_stg_support_1": { + "database": null, + "schema": "ci_checks", + "name": "timestamp_history_stg_support_1", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/features/timestamp_history_stg_support_1.sql", + "original_file_path": "models/features/timestamp_history_stg_support_1.sql", + "unique_id": "model.generated_9.timestamp_history_stg_support_1", + "fqn": [ + "generated_9", + "models", + "features", + "timestamp_history_stg_support_1" + ], + "alias": "timestamp_history_stg_support_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "snapshot", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": [ + "id" + ], + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Timestamp history of stg_support_1", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.timestamp_history_stg_support_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_support_1" + ] + } + }, + "model.generated_9.channel_labels": { + "database": null, + "schema": "ci_checks", + "name": "channel_labels", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/rendering/channel_labels.sql", + "original_file_path": "models/rendering/channel_labels.sql", + "unique_id": "model.generated_9.channel_labels", + "fqn": [ + "generated_9", + "models", + "rendering", + "channel_labels" + ], + "alias": "channel_labels", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Normalised channel labels", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.channel_labels", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_9.labelled_channels" + ] + } + }, + "model.generated_9.configured_stg_support_1": { + "database": null, + "schema": "ci_checks", + "name": "configured_stg_support_1", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/rendering/configured_stg_support_1.sql", + "original_file_path": "models/rendering/configured_stg_support_1.sql", + "unique_id": "model.generated_9.configured_stg_support_1", + "fqn": [ + "generated_9", + "models", + "rendering", + "configured_stg_support_1" + ], + "alias": "configured_stg_support_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "release" + ], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "release" + ], + "description": "Configured copy of stg_support_1 (réglé)", + "columns": { + "id": { + "name": "id", + "description": "Row key", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "Montant réglé", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.configured_stg_support_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_support_1" + ] + } + }, + "model.generated_9.labelled_stg_support_1": { + "database": null, + "schema": "ci_checks", + "name": "labelled_stg_support_1", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/rendering/labelled_stg_support_1.sql", + "original_file_path": "models/rendering/labelled_stg_support_1.sql", + "unique_id": "model.generated_9.labelled_stg_support_1", + "fqn": [ + "generated_9", + "models", + "rendering", + "labelled_stg_support_1" + ], + "alias": "labelled_stg_support_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Labelled copy of stg_support_1", + "columns": { + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.labelled_stg_support_1", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.tidy_status", + "model.generated_9.stg_support_1" + ] + } + }, + "model.generated_9.legacy_event_ids": { + "database": null, + "schema": "ci_checks", + "name": "legacy_event_ids", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/rendering/legacy_event_ids.sql", + "original_file_path": "models/rendering/legacy_event_ids.sql", + "unique_id": "model.generated_9.legacy_event_ids", + "fqn": [ + "generated_9", + "models", + "rendering", + "legacy_event_ids" + ], + "alias": "legacy_event_ids", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Ids read through a macro-generated reference", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.legacy_event_ids", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_support_0" + ] + } + }, + "model.generated_9.stated_stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "stated_stg_support_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/rendering/stated_stg_support_0.sql", + "original_file_path": "models/rendering/stated_stg_support_0.sql", + "unique_id": "model.generated_9.stated_stg_support_0", + "fqn": [ + "generated_9", + "models", + "rendering", + "stated_stg_support_0" + ], + "alias": "stated_stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [], + "description": "Enum-typed copy of stg_support_0", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "tier": { + "name": "tier", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.stated_stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_support_0" + ] + } + }, + "model.generated_9.support_summary_0": { + "database": null, + "schema": "ci_checks", + "name": "support_summary_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/support/marts/support_summary_0.sql", + "original_file_path": "models/support/marts/support_summary_0.sql", + "unique_id": "model.generated_9.support_summary_0", + "fqn": [ + "generated_9", + "models", + "support", + "marts", + "support_summary_0" + ], + "alias": "support_summary_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "support", + "marts" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [ + { + "sql": "SELECT 'ci_checks.support_summary_0' AS refreshed_relation, 'café ☕ counter' AS refresh_label", + "transaction": true, + "index": 0 + }, + { + "sql": "SELECT 'ci_checks.support_summary_0' AS refreshed", + "transaction": true, + "index": 1 + } + ], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "support", + "marts" + ], + "description": "Summary of support activity 0", + "columns": {}, + "meta": { + "sqlbuild": { + "lifecycle_hooks": { + "post_hooks": [ + { + "type": "sql", + "statement": "SELECT 'ci_checks.support_summary_0' AS refreshed_relation, 'café ☕ counter' AS refresh_label", + "name": "record_refresh", + "relative_path": "hooks/sql/record_refresh.sql", + "definition_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "kwargs": { + "relation": "@@CTX:destination.qualified", + "label": "café ☕ counter" + }, + "description": "Record a refresh for one relation" + }, + { + "type": "sql", + "statement": "SELECT 'ci_checks.support_summary_0' AS refreshed" + } + ] + } + } + }, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.support_summary_0", + "depends_on": { + "macros": [], + "nodes": [ + "model.generated_9.stg_support_0" + ] + } + }, + "model.generated_9.stg_support_0": { + "database": null, + "schema": "ci_checks", + "name": "stg_support_0", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/support/staging/stg_support_0.sql", + "original_file_path": "models/support/staging/stg_support_0.sql", + "unique_id": "model.generated_9.stg_support_0", + "fqn": [ + "generated_9", + "models", + "support", + "staging", + "stg_support_0" + ], + "alias": "stg_support_0", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged support events 0", + "columns": {}, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.stg_support_0", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_9.raw_events_0" + ] + } + }, + "model.generated_9.stg_support_1": { + "database": null, + "schema": "ci_checks", + "name": "stg_support_1", + "resource_type": "model", + "package_name": "generated_9", + "path": "models/support/staging/stg_support_1.sql", + "original_file_path": "models/support/staging/stg_support_1.sql", + "unique_id": "model.generated_9.stg_support_1", + "fqn": [ + "generated_9", + "models", + "support", + "staging", + "stg_support_1" + ], + "alias": "stg_support_1", + "config": { + "enabled": true, + "alias": null, + "schema": "ci_checks", + "database": null, + "tags": [ + "staging" + ], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "merge_exclude_columns": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": {}, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": "ignore", + "on_configuration_change": "apply", + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "enforced": false, + "alias_types": true + } + }, + "tags": [ + "staging" + ], + "description": "Staged support events 1", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": null, + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "group": null, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "build_path": null, + "unrendered_config": {}, + "config_call_dict": {}, + "unrendered_config_call_dict": {}, + "relation_name": "ci_checks.stg_support_1", + "depends_on": { + "macros": [], + "nodes": [ + "source.generated_9.raw_events_0" + ] + } + } + }, + "sources": { + "source.generated_9.configured_events": { + "database": null, + "schema": "", + "name": "configured_events", + "resource_type": "source", + "package_name": "generated_9", + "path": "sources/configured.yml", + "original_file_path": "sources/configured.yml", + "unique_id": "source.generated_9.configured_events", + "fqn": [ + "generated_9", + "configured_events" + ], + "source_name": "configured_events", + "source_description": "", + "loader": "", + "identifier": "configured_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Configured feed events", + "columns": { + "id": { + "name": "id", + "description": "Key id", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "owner": "orders team" + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_9.labelled_channels": { + "database": null, + "schema": "", + "name": "labelled_channels", + "resource_type": "source", + "package_name": "generated_9", + "path": "sources/labelled.yml", + "original_file_path": "sources/labelled.yml", + "unique_id": "source.generated_9.labelled_channels", + "fqn": [ + "generated_9", + "labelled_channels" + ], + "source_name": "labelled_channels", + "source_description": "", + "loader": "", + "identifier": "labelled_channels", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Channel labels normalised in the source expression.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "channel": { + "name": "channel", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_9.loaded_products": { + "database": null, + "schema": "ci_checks", + "name": "loaded_products", + "resource_type": "source", + "package_name": "generated_9", + "path": "sources/managed.yml", + "original_file_path": "sources/managed.yml", + "unique_id": "source.generated_9.loaded_products", + "fqn": [ + "generated_9", + "loaded_products" + ], + "source_name": "loaded_products", + "source_description": "", + "loader": "", + "identifier": "loaded_products", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Products loaded by a project loader.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "label": { + "name": "label", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": { + "sqlbuild": { + "loader": "loaded_products", + "auto_load": false, + "write_strategy": "table" + } + }, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_9.open_events": { + "database": null, + "schema": "", + "name": "open_events", + "resource_type": "source", + "package_name": "generated_9", + "path": "sources/open.yml", + "original_file_path": "sources/open.yml", + "unique_id": "source.generated_9.open_events", + "fqn": [ + "generated_9", + "open_events" + ], + "source_name": "open_events", + "source_description": "", + "loader": "", + "identifier": "open_events", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Events whose columns are only known to the warehouse.", + "columns": {}, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_9.raw_events_0": { + "database": null, + "schema": "", + "name": "raw_events_0", + "resource_type": "source", + "package_name": "generated_9", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_9.raw_events_0", + "fqn": [ + "generated_9", + "raw_events_0" + ], + "source_name": "raw_events_0", + "source_description": "", + "loader": "", + "identifier": "raw_events_0", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 0.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + }, + "source.generated_9.raw_events_1": { + "database": null, + "schema": "", + "name": "raw_events_1", + "resource_type": "source", + "package_name": "generated_9", + "path": "sources/raw.yml", + "original_file_path": "sources/raw.yml", + "unique_id": "source.generated_9.raw_events_1", + "fqn": [ + "generated_9", + "raw_events_1" + ], + "source_name": "raw_events_1", + "source_description": "", + "loader": "", + "identifier": "raw_events_1", + "quoting": {}, + "loaded_at_field": null, + "freshness": null, + "external": null, + "description": "Generated event feed 1.", + "columns": { + "id": { + "name": "id", + "description": "", + "meta": {}, + "data_type": "INTEGER", + "constraints": [], + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "", + "meta": {}, + "data_type": "DOUBLE", + "constraints": [], + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": "VARCHAR", + "constraints": [], + "quote": null, + "tags": [] + }, + "created_at": { + "name": "created_at", + "description": "", + "meta": {}, + "data_type": "TIMESTAMP", + "constraints": [], + "quote": null, + "tags": [] + } + }, + "meta": {}, + "source_meta": {}, + "tags": [], + "config": {}, + "patch_path": null, + "unrendered_config": {}, + "relation_name": null + } + }, + "macros": { + "macro.generated_9.adjust_0": { + "name": "adjust_0", + "resource_type": "macro", + "package_name": "generated_9", + "path": "macros/adjust_0.py", + "original_file_path": "macros/adjust_0.py", + "unique_id": "macro.generated_9.adjust_0", + "macro_sql": "def adjust_0(expression: str) -> str:\n \"\"\"Offset an amount.\"\"\"\n return f\"({expression} + 0 + 1)\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_9.tidy_label": { + "name": "tidy_label", + "resource_type": "macro", + "package_name": "generated_9", + "path": "macros/labels.py", + "original_file_path": "macros/labels.py", + "unique_id": "macro.generated_9.tidy_label", + "macro_sql": "def tidy_label(expression: str) -> str:\n \"\"\"Trim and lower-case a label.\"\"\"\n return f\"LOWER(TRIM({expression}))\"\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "global", + "sqlbuild_scope_path": null + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_9.legacy_events": { + "name": "legacy_events", + "resource_type": "macro", + "package_name": "generated_9", + "path": "models/rendering/_sqlbuild/_macros/legacy.py", + "original_file_path": "models/rendering/_sqlbuild/_macros/legacy.py", + "unique_id": "macro.generated_9.legacy_events", + "macro_sql": "def legacy_events() -> str:\n \"\"\"Return a staged relation the way a migrated project wrote it.\"\"\"\n return '__ref(\"stg_support_0\")'\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "models/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_9.event_rows": { + "name": "event_rows", + "resource_type": "macro", + "package_name": "generated_9", + "path": "tests/unit/rendering/_sqlbuild/_macros/fixtures.py", + "original_file_path": "tests/unit/rendering/_sqlbuild/_macros/fixtures.py", + "unique_id": "macro.generated_9.event_rows", + "macro_sql": "def event_rows(count: int = 2) -> str:\n \"\"\"Return fixture event rows.\"\"\"\n return \" UNION ALL \".join(\n f\"SELECT {index} AS id, CAST({index} AS DOUBLE) AS amount, \"\n f\"'placed' AS status, \"\n f\"TIMESTAMP '2026-01-0{index} 00:00:00' AS created_at\"\n for index in range(1, count + 1)\n )\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": { + "sqlbuild_visibility": "local", + "sqlbuild_scope_path": "tests/unit/rendering" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + }, + "macro.generated_9__sqlbuild_hooks.record_refresh": { + "name": "record_refresh", + "resource_type": "macro", + "package_name": "generated_9__sqlbuild_hooks", + "path": "hooks/sql/record_refresh.sql", + "original_file_path": "hooks/sql/record_refresh.sql", + "unique_id": "macro.generated_9__sqlbuild_hooks.record_refresh", + "macro_sql": "SELECT @'relation' AS refreshed_relation, @'label' AS refresh_label", + "depends_on": { + "macros": [] + }, + "description": "Record a refresh for one relation", + "meta": { + "sqlbuild_resource_type": "sql_hook", + "sqlbuild_hook_name": "record_refresh" + }, + "docs": { + "show": true, + "node_color": null + }, + "patch_path": null, + "arguments": [], + "supported_languages": null + } + }, + "exposures": {}, + "metrics": {}, + "groups": {}, + "selectors": {}, + "disabled": {}, + "parent_map": { + "model.generated_9.combined_stg_billing_0": [ + "model.generated_9.stg_billing_0", + "model.generated_9.stg_support_0" + ], + "model.generated_9.every_open_event": [ + "source.generated_9.open_events" + ], + "model.generated_9.every_raw_events_1": [ + "source.generated_9.raw_events_1" + ], + "model.generated_9.every_stg_billing_0": [ + "model.generated_9.stg_billing_0" + ], + "model.generated_9.passed_stg_billing_0": [ + "model.generated_9.stg_billing_0" + ], + "model.generated_9.pivot_input_stg_support_0": [ + "model.generated_9.stg_support_0" + ], + "model.generated_9.pivoted_stg_support_0": [ + "model.generated_9.pivot_input_stg_support_0" + ], + "model.generated_9.quoted_stg_support_0": [ + "model.generated_9.stg_support_0" + ], + "model.generated_9.typed_stg_billing_0": [ + "model.generated_9.stg_billing_0" + ], + "model.generated_9.unanalysed_stg_support_1": [ + "model.generated_9.stg_support_1" + ], + "model.generated_9.billing_summary_0": [ + "model.generated_9.stg_billing_0" + ], + "model.generated_9.stg_billing_0": [ + "source.generated_9.raw_events_0" + ], + "model.generated_9.append_stg_support_0": [ + "model.generated_9.stg_support_0" + ], + "model.generated_9.batched_rolling_window_stg_support_1": [ + "model.generated_9.stg_support_1" + ], + "model.generated_9.delete_insert_stg_billing_0": [ + "model.generated_9.stg_billing_0" + ], + "model.generated_9.flagged_stg_billing_0": [ + "model.generated_9.is_placed", + "model.generated_9.is_large", + "model.generated_9.stg_billing_0" + ], + "model.generated_9.guarded_stg_billing_0": [ + "model.generated_9.stg_billing_0" + ], + "model.generated_9.kept_stg_support_1": [ + "model.generated_9.stg_support_1" + ], + "model.generated_9.product_labels": [ + "source.generated_9.loaded_products" + ], + "model.generated_9.spaced_stg_support_0": [ + "model.generated_9.stg_support_0" + ], + "model.generated_9.timestamp_history_stg_support_1": [ + "model.generated_9.stg_support_1" + ], + "model.generated_9.channel_labels": [ + "source.generated_9.labelled_channels" + ], + "model.generated_9.configured_stg_support_1": [ + "model.generated_9.stg_support_1" + ], + "model.generated_9.labelled_stg_support_1": [ + "model.generated_9.tidy_status", + "model.generated_9.stg_support_1" + ], + "model.generated_9.legacy_event_ids": [ + "model.generated_9.stg_support_0" + ], + "model.generated_9.stated_stg_support_0": [ + "model.generated_9.stg_support_0" + ], + "model.generated_9.support_summary_0": [ + "model.generated_9.stg_support_0" + ], + "model.generated_9.stg_support_0": [ + "source.generated_9.raw_events_0" + ], + "model.generated_9.stg_support_1": [ + "source.generated_9.raw_events_0" + ], + "source.generated_9.configured_events": [], + "source.generated_9.labelled_channels": [], + "source.generated_9.loaded_products": [], + "source.generated_9.open_events": [], + "source.generated_9.raw_events_0": [], + "source.generated_9.raw_events_1": [], + "model.generated_9.configured_label": [], + "model.generated_9.is_placed": [], + "model.generated_9.tidy_status": [], + "model.generated_9.is_large": [] + }, + "group_map": {}, + "docs": {}, + "saved_queries": {}, + "semantic_models": {}, + "unit_tests": {} + } +} diff --git a/tests/goldens/compiler/seed_range.toml b/tests/goldens/compiler/seed_range.toml new file mode 100644 index 0000000000..c0d6bdc52f --- /dev/null +++ b/tests/goldens/compiler/seed_range.toml @@ -0,0 +1,2 @@ +seed_start = 0 +seeds = 12 diff --git a/tests/integration/src/sqlbuild/adapter/type_system/_test_types.py b/tests/integration/src/sqlbuild/adapter/type_system/_test_types.py index 762e82405f..1d687c65c5 100644 --- a/tests/integration/src/sqlbuild/adapter/type_system/_test_types.py +++ b/tests/integration/src/sqlbuild/adapter/type_system/_test_types.py @@ -33,3 +33,15 @@ class DeepTypeTestCase: description: str type_sql: str expected_native: None + + +@dataclass(frozen=True) +class PublicNativeTypeTestCase: + """Types normalized through the public entry point under the preview engine.""" + + description: str + engine: str + dialect: str + type_strings: tuple[str, ...] + expected_native_calls: tuple[tuple[str, str], ...] + expected_answered: int diff --git a/tests/integration/src/sqlbuild/adapter/type_system/test_native_type_parity.py b/tests/integration/src/sqlbuild/adapter/type_system/test_native_type_parity.py index eb481b27a3..93ab4d3b7c 100644 --- a/tests/integration/src/sqlbuild/adapter/type_system/test_native_type_parity.py +++ b/tests/integration/src/sqlbuild/adapter/type_system/test_native_type_parity.py @@ -3,13 +3,22 @@ from __future__ import annotations import random +from collections.abc import Callable import pytest +import sqlbuild._native as native_module +from sqlbuild.adapter.contract.models import NormalizedType +from sqlbuild.adapter.type_system._helpers.type_normalization import ( + normalize_type as cached_normalize_type, +) from sqlbuild.adapter.type_system.main._native_normalize_type import normalize_native_type +from sqlbuild.adapter.type_system.main.normalize_type import normalize_type +from sqlbuild.compiler.frontier.constants import COMPILER_ENGINE_ENV_VAR from tests.integration.src.sqlbuild.adapter.type_system._test_types import ( DeepTypeTestCase, GeneratedTypeParityTestCase, + PublicNativeTypeTestCase, TypeParityTestCase, ) from tests.integration.src.sqlbuild.adapter.type_system.helpers import ( @@ -169,5 +178,51 @@ def test_given_type_past_the_wheel_depth_when_normalizing_natively_then_it_defer ) +@pytest.mark.parametrize( + "test_case", + [ + PublicNativeTypeTestCase( + description="the public entry point asks native first under the preview engine", + engine="native-preview", + dialect="snowflake", + type_strings=("NUMBER(38, 0)", "VARCHAR", "TIMESTAMP_NTZ(9)"), + expected_native_calls=( + ("NUMBER(38, 0)", "snowflake"), + ("VARCHAR", "snowflake"), + ("TIMESTAMP_NTZ(9)", "snowflake"), + ), + expected_answered=3, + ), + ], + ids=lambda case: case.description, +) +def test_given_preview_engine_when_normalizing_publicly_then_native_answers( + test_case: PublicNativeTypeTestCase, monkeypatch: pytest.MonkeyPatch +) -> None: + calls: list[tuple[str, str]] = [] + answers: list[object] = [] + native_normalize: Callable[[str, str], object] = native_module.normalize_type + + def spy(type_sql: str, dialect: str) -> object: + calls.append((type_sql, dialect)) + answers.append(native_normalize(type_sql, dialect)) + return answers[-1] + + monkeypatch.setenv(COMPILER_ENGINE_ENV_VAR, test_case.engine) + monkeypatch.setattr(native_module, "normalize_type", spy) + cached_normalize_type.cache_clear() + normalized: list[NormalizedType] = [ + normalize_type(type_sql=type_sql, dialect=test_case.dialect) + for type_sql in test_case.type_strings + ] + cached_normalize_type.cache_clear() + + assert ( + tuple(calls), + sum(answer is not None for answer in answers), + len(normalized), + ) == (test_case.expected_native_calls, test_case.expected_answered, len(test_case.type_strings)) + + if __name__ == "__main__": pytest.main([__file__, "-vv"]) diff --git a/tests/unit/scripts/compiler_differential/_helpers/goldens/__init__.py b/tests/unit/scripts/compiler_differential/_helpers/goldens/__init__.py new file mode 100644 index 0000000000..c18b17ecc8 --- /dev/null +++ b/tests/unit/scripts/compiler_differential/_helpers/goldens/__init__.py @@ -0,0 +1 @@ +"""Unit tests for the golden compile outputs.""" diff --git a/tests/unit/scripts/compiler_differential/_helpers/goldens/_test_types.py b/tests/unit/scripts/compiler_differential/_helpers/goldens/_test_types.py new file mode 100644 index 0000000000..7f20ecb41a --- /dev/null +++ b/tests/unit/scripts/compiler_differential/_helpers/goldens/_test_types.py @@ -0,0 +1,39 @@ +"""Test case types for the golden compile outputs.""" + +from __future__ import annotations + +from dataclasses import dataclass +from pathlib import Path + +from scripts.compiler_differential.models import EngineRun + + +@dataclass(frozen=True) +class GoldenPathTestCase: + """A corpus project name and where its golden lives, if anywhere.""" + + description: str + project: str + expected_path: Path | None + + +@dataclass(frozen=True) +class GoldenPayloadTestCase: + """One engine run and the masked golden it must produce.""" + + description: str + run: EngineRun + masked_paths: tuple[tuple[str, str], ...] + expected_payload: dict[str, object] + + +@dataclass(frozen=True) +class GoldenCheckTestCase: + """A recorded golden, the runs checked against it, and the differences reported.""" + + description: str + project: str + recorded: tuple[EngineRun, ...] + checked: tuple[EngineRun, ...] + expected_differences: tuple[tuple[str, tuple[str, str] | None], ...] + seed_range_dir: str = "" diff --git a/tests/unit/scripts/compiler_differential/_helpers/goldens/helpers.py b/tests/unit/scripts/compiler_differential/_helpers/goldens/helpers.py new file mode 100644 index 0000000000..a4eca5e4ff --- /dev/null +++ b/tests/unit/scripts/compiler_differential/_helpers/goldens/helpers.py @@ -0,0 +1,46 @@ +"""Engine runs for the golden output tests.""" + +from __future__ import annotations + +import json + +from scripts.compiler_differential.models import CommandOutcome, EngineRun + +PROJECT_PATH: str = "/work/failure__unknown-ref/project" + + +def engine_run(*, engine: str, message: str, compiled_sql: str) -> EngineRun: + """A one-command run whose first diagnostic carries `message` and one compiled model.""" + + report: dict[str, object] = { + "compile_timings": {"total": 1.5}, + "diagnostics": [{"code": "P001", "message": message, "severity": "error"}], + } + return EngineRun( + engine=engine, + outcomes=( + CommandOutcome( + label="compile", exit_code=1, stdout=json.dumps(report), stderr="done in 12ms\n" + ), + ), + compiled={"marts/customer_totals.sql": compiled_sql.encode("utf-8")}, + manifest=json.dumps( + { + "metadata": {"generated_at": "now"}, + "child_map": {}, + "nodes": { + "model.orders.customer_totals": { + "name": "customer_totals", + "compiled_code": compiled_sql, + "raw_code": "SELECT 1", + "checksum": {"checksum": "abc"}, + "config": {"materialized": "table"}, + } + }, + "sources": {}, + "macros": {}, + "parent_map": {"model.orders.customer_totals": []}, + } + ), + dag=None, + ) diff --git a/tests/unit/scripts/compiler_differential/_helpers/goldens/test_compiler_goldens.py b/tests/unit/scripts/compiler_differential/_helpers/goldens/test_compiler_goldens.py new file mode 100644 index 0000000000..44e1fc9f37 --- /dev/null +++ b/tests/unit/scripts/compiler_differential/_helpers/goldens/test_compiler_goldens.py @@ -0,0 +1,214 @@ +"""Golden compile outputs are masked, located per corpus project, checked and rewritten.""" + +from __future__ import annotations + +from pathlib import Path + +import pytest + +from scripts.compiler_differential._helpers.goldens.goldens import ( + golden_differences, + golden_path, + golden_payload, + write_golden_seed_range, +) +from scripts.compiler_differential.models import CorpusProject, Difference, ExpectedOutcome +from tests.unit.scripts.compiler_differential._helpers.goldens._test_types import ( + GoldenCheckTestCase, + GoldenPathTestCase, + GoldenPayloadTestCase, +) +from tests.unit.scripts.compiler_differential._helpers.goldens.helpers import ( + PROJECT_PATH, + engine_run, +) + +_SQL: str = "SELECT customer_id\nFROM orders -- 20261009T010203Z_0123456789ab\n" +_MESSAGE: str = f"model references unknown model 'ghost' in '{PROJECT_PATH}/models/a.sql'" + + +@pytest.mark.parametrize( + "test_case", + [ + GoldenPathTestCase( + description="seed", project="seed/3", expected_path=Path("goldens/seed/3.json") + ), + GoldenPathTestCase( + description="dialect_seed", + project="seed/0-snowflake", + expected_path=Path("goldens/seed/0-snowflake.json"), + ), + GoldenPathTestCase( + description="failure_case", + project="failure/unknown-ref", + expected_path=Path("goldens/failure/unknown-ref.json"), + ), + GoldenPathTestCase(description="dense_has_none", project="dense/3000", expected_path=None), + ], + ids=lambda case: case.description, +) +def test_given_corpus_project_when_locating_its_golden_then_only_golden_corpora_have_one( + test_case: GoldenPathTestCase, +) -> None: + path: Path | None = golden_path(golden_dir=Path("goldens"), project=test_case.project) + + assert path == test_case.expected_path + + +@pytest.mark.parametrize( + "test_case", + [ + GoldenPayloadTestCase( + description="paths_ids_timings_and_repeated_sql_masked", + run=engine_run(engine="python", message=_MESSAGE, compiled_sql=_SQL), + masked_paths=((PROJECT_PATH, ""),), + expected_payload={ + "commands": [ + { + "label": "compile", + "exit_code": 1, + "diagnostics": [ + { + "code": "P001", + "message": ( + "model references unknown model 'ghost' in " + "'/models/a.sql'" + ), + "severity": "error", + } + ], + } + ], + "compiled": { + "marts/customer_totals.sql": [ + "SELECT customer_id", + "FROM orders -- ", + "", + ] + }, + "manifest": { + "nodes": { + "model.orders.customer_totals": { + "name": "customer_totals", + "config": {"materialized": "table"}, + } + }, + "sources": {}, + "macros": {}, + "parent_map": {"model.orders.customer_totals": []}, + }, + }, + ) + ], + ids=lambda case: case.description, +) +def test_given_engine_run_when_building_golden_then_run_specific_noise_is_masked( + test_case: GoldenPayloadTestCase, +) -> None: + payload: dict[str, object] = golden_payload( + run=test_case.run, masked_paths=test_case.masked_paths + ) + + assert payload == test_case.expected_payload + + +@pytest.mark.parametrize( + "test_case", + [ + GoldenCheckTestCase( + description="identical_engines_match", + project="failure/unknown-ref", + recorded=(engine_run(engine="python", message=_MESSAGE, compiled_sql=_SQL),), + checked=( + engine_run(engine="python", message=_MESSAGE, compiled_sql=_SQL), + engine_run(engine="native", message=_MESSAGE, compiled_sql=_SQL), + ), + expected_differences=(), + ), + GoldenCheckTestCase( + description="changed_sql_names_the_engine", + project="failure/unknown-ref", + recorded=(engine_run(engine="python", message=_MESSAGE, compiled_sql=_SQL),), + checked=( + engine_run(engine="python", message=_MESSAGE, compiled_sql=_SQL), + engine_run(engine="native", message=_MESSAGE, compiled_sql="SELECT 2\n"), + ), + expected_differences=(("golden (native)", ("golden", "native")),), + ), + GoldenCheckTestCase( + description="missing_failure_golden_fails", + project="failure/unknown-ref", + recorded=(), + checked=(engine_run(engine="python", message=_MESSAGE, compiled_sql=_SQL),), + expected_differences=(("golden unknown-ref.json", ("golden", "hint")),), + ), + GoldenCheckTestCase( + description="missing_seed_golden_outside_the_recorded_range_is_skipped", + project="seed/40", + recorded=(), + checked=(engine_run(engine="python", message=_MESSAGE, compiled_sql=_SQL),), + expected_differences=(), + ), + GoldenCheckTestCase( + description="missing_seed_golden_inside_the_recorded_range_fails", + project="seed/3", + recorded=(), + checked=(engine_run(engine="python", message=_MESSAGE, compiled_sql=_SQL),), + expected_differences=(("golden 3.json", ("golden", "hint")),), + ), + GoldenCheckTestCase( + description="missing_dialect_variant_of_the_recorded_first_seed_fails", + project="seed/0-postgres", + recorded=(), + checked=(engine_run(engine="python", message=_MESSAGE, compiled_sql=_SQL),), + expected_differences=(("golden 0-postgres.json", ("golden", "hint")),), + ), + GoldenCheckTestCase( + description="dialect_variant_of_an_ad_hoc_first_seed_is_skipped", + project="seed/3-postgres", + recorded=(), + checked=(engine_run(engine="python", message=_MESSAGE, compiled_sql=_SQL),), + expected_differences=(), + ), + GoldenCheckTestCase( + description="missing_seed_range_fails_closed_even_with_the_seed_golden", + project="seed/3", + recorded=(engine_run(engine="python", message=_MESSAGE, compiled_sql=_SQL),), + checked=(engine_run(engine="python", message=_MESSAGE, compiled_sql=_SQL),), + expected_differences=(("golden seed_range.toml", ("golden", "hint")),), + seed_range_dir="elsewhere", + ), + ], + ids=lambda case: case.description, +) +def test_given_recorded_golden_when_checking_runs_then_each_differing_engine_is_reported( + test_case: GoldenCheckTestCase, tmp_path: Path +) -> None: + project: CorpusProject = CorpusProject( + name=test_case.project, commands=(), expected=ExpectedOutcome() + ) + write_golden_seed_range(golden_dir=tmp_path / test_case.seed_range_dir, seed_start=0, seeds=12) + for recorded in test_case.recorded: + _ = golden_differences( + project=project, + runs=(recorded,), + golden_dir=tmp_path, + mode="update", + masked_paths=((PROJECT_PATH, ""),), + ) + + differences: list[Difference] = golden_differences( + project=project, + runs=test_case.checked, + golden_dir=tmp_path, + mode="check", + masked_paths=((PROJECT_PATH, ""),), + ) + + assert [(difference.artifact, difference.labels) for difference in differences] == list( + test_case.expected_differences + ) + + +if __name__ == "__main__": + pytest.main([__file__, "-vv"]) diff --git a/tests/unit/scripts/compiler_differential/_helpers/running/_test_types.py b/tests/unit/scripts/compiler_differential/_helpers/running/_test_types.py index 6233c40c85..e08c0665ac 100644 --- a/tests/unit/scripts/compiler_differential/_helpers/running/_test_types.py +++ b/tests/unit/scripts/compiler_differential/_helpers/running/_test_types.py @@ -5,7 +5,12 @@ from collections.abc import Callable from dataclasses import dataclass -from scripts.compiler_differential.models import ExpectedOutcome, ProjectComparison +from scripts.compiler_differential.models import ( + AnalysisRecords, + ExpectedOutcome, + ProjectComparison, + RecordedRun, +) @dataclass(frozen=True) @@ -62,6 +67,7 @@ class SummaryTestCase: description: str comparisons: list[ProjectComparison] missing_coverage: dict[str, tuple[str, ...]] + gate_failures: tuple[str, ...] expected_lines: tuple[str, ...] expected_absent: tuple[str, ...] @@ -74,4 +80,37 @@ class AnalysisRecordsTestCase: files: dict[str, str] expected_wheel_sites: dict[tuple[str, str], int] expected_deferrals: dict[tuple[str, str], int] + expected_fallbacks: dict[tuple[str, str], int] expected_lines: tuple[str, ...] + + +@dataclass(frozen=True) +class FallbackGateTestCase: + """An allow-list file, what one run observed, and the problems the gate must report.""" + + description: str + allow_list: str + observed: dict[tuple[str, str, str, str], dict[str, int]] + run: RecordedRun + expected_problems: list[str] + + +@dataclass(frozen=True) +class FallbackRecordsTestCase: + """Per-engine records of one project and the allow-list entries they add up to.""" + + description: str + project: str + records: tuple[AnalysisRecords, AnalysisRecords] + expected_observed: dict[tuple[str, str, str, str], dict[str, int]] + + +@dataclass(frozen=True) +class FallbackRewriteTestCase: + """An allow-list, a run that rewrites it, and the counts the rewritten list must hold.""" + + description: str + allow_list: str + observed: dict[tuple[str, str, str, str], dict[str, int]] + run: RecordedRun + expected_counts: dict[tuple[str, str, str, str], dict[str, int]] diff --git a/tests/unit/scripts/compiler_differential/_helpers/running/test_native_fallbacks.py b/tests/unit/scripts/compiler_differential/_helpers/running/test_native_fallbacks.py new file mode 100644 index 0000000000..11ac5a0584 --- /dev/null +++ b/tests/unit/scripts/compiler_differential/_helpers/running/test_native_fallbacks.py @@ -0,0 +1,262 @@ +"""The fallback allow-list fails on new, changed and vanished entries and records new counts.""" + +from __future__ import annotations + +from pathlib import Path + +import pytest + +from scripts.compiler_differential._helpers.running.native_fallbacks import ( + fallback_problems, + observed_fallbacks, + read_allow_list, + write_allow_list, +) +from scripts.compiler_differential.models import ( + AllowList, + AnalysisRecords, + ProjectComparison, + RecordedRun, +) +from scripts.compiler_differential.types import FallbackKey +from tests.unit.scripts.compiler_differential._helpers.running._test_types import ( + FallbackGateTestCase, + FallbackRecordsTestCase, + FallbackRewriteTestCase, +) + +_VARIABLES: FallbackKey = ("native", "model_loop", "model_loop.sql_variables", "deferred") +_ANSWER: FallbackKey = ( + "native", + "reference_extraction", + "reference_extraction.native", + "reference_scans", +) +_ANSWER_ENTRY: str = ( + '\n[[entry]]\nengine = "native"\nstage = "reference_extraction"\n' + 'site = "reference_extraction.native"\nkind = "reference_scans"\n' +) +_LOOP_ANSWER: FallbackKey = ("native", "model_loop", "model_loop.native", "models") +_LOOP_VARIABLE_ANSWER: FallbackKey = ( + "native", + "model_loop", + "model_loop.native", + "sql_variables", +) +_LOOP_ANSWER_ENTRY: str = ( + '\n[[entry]]\nengine = "native"\nstage = "model_loop"\n' + 'site = "model_loop.native"\nkind = "models"\n' +) +_SESSION: FallbackKey = ("native-preview", "model_analysis", "analysis_session", "session") +_SHIPPED_RUN: RecordedRun = RecordedRun( + engines=("python", "native"), corpora=("seeds", "failures"), seed_start=0, seeds=12 +) +_LIST_HEAD: str = "seed_start = 0\nseeds = 12\n" +_VARIABLES_ENTRY: str = ( + '\n[[entry]]\nengine = "native"\nstage = "model_loop"\n' + 'site = "model_loop.sql_variables"\nkind = "deferred"\n' +) + + +@pytest.mark.parametrize( + "test_case", + [ + FallbackRecordsTestCase( + description="fallbacks_and_deferrals_keyed_by_engine_stage_site_kind", + project="seed/3", + records=( + AnalysisRecords(), + AnalysisRecords( + fallbacks={("model_loop.sql_variables", "deferred"): 2}, + deferrals={("session", "analysis_session"): 1}, + ), + ), + expected_observed={ + ("native-preview", "model_loop", "model_loop.sql_variables", "deferred"): { + "seed": 2 + }, + _SESSION: {"seed": 1}, + }, + ) + ], + ids=lambda case: case.description, +) +def test_given_engine_records_when_observing_then_entries_are_summed_per_corpus( + test_case: FallbackRecordsTestCase, +) -> None: + comparison: ProjectComparison = ProjectComparison( + project=test_case.project, differences=(), seconds=1.0, records=test_case.records + ) + + observed: dict[FallbackKey, dict[str, int]] = observed_fallbacks( + comparisons=[comparison], engines=("python", "native-preview") + ) + + assert observed == test_case.expected_observed + + +@pytest.mark.parametrize( + "test_case", + [ + FallbackGateTestCase( + description="exact_counts_pass", + allow_list=_LIST_HEAD + _VARIABLES_ENTRY + "counts = { failure = 3, seed = 195 }\n", + observed={_VARIABLES: {"failure": 3, "seed": 195}}, + run=_SHIPPED_RUN, + expected_problems=[], + ), + FallbackGateTestCase( + description="unlisted_entry_fails", + allow_list=_LIST_HEAD, + observed={_VARIABLES: {"seed": 195}}, + run=_SHIPPED_RUN, + expected_problems=[ + "native model_loop model_loop.sql_variables deferred (seed): 195 not on the " + "allow-list; port it or list it with a reason" + ], + ), + FallbackGateTestCase( + description="vanished_entry_with_more_native_answers_fails_until_removed", + allow_list=_LIST_HEAD + + _VARIABLES_ENTRY + + "counts = { seed = 195 }\n" + + _LOOP_ANSWER_ENTRY + + "counts = { seed = 10 }\n", + observed={_LOOP_ANSWER: {"seed": 10}, _LOOP_VARIABLE_ANSWER: {"seed": 195}}, + run=_SHIPPED_RUN, + expected_problems=[ + "native model_loop model_loop.native sql_variables (seed): native answered 195, " + "not on the allow-list; record it", + "native model_loop model_loop.sql_variables deferred (seed): listed but no " + "longer occurs; remove it from the allow-list", + ], + ), + FallbackGateTestCase( + description="vanished_entry_without_more_native_answers_means_the_stage_is_off", + allow_list=_LIST_HEAD + + _VARIABLES_ENTRY + + "counts = { seed = 195 }\n" + + _LOOP_ANSWER_ENTRY + + "counts = { seed = 10 }\n", + observed={_LOOP_ANSWER: {"seed": 10}}, + run=_SHIPPED_RUN, + expected_problems=[ + "native model_loop model_loop.sql_variables deferred (seed): fallback disappeared " + "but native answers did not appear; the stage may be switched off. A port that " + "removes a fallback must report native answers for the work it now does" + ], + ), + FallbackGateTestCase( + description="changed_count_fails", + allow_list=_LIST_HEAD + _VARIABLES_ENTRY + "counts = { seed = 195 }\n", + observed={_VARIABLES: {"seed": 196}}, + run=_SHIPPED_RUN, + expected_problems=[ + "native model_loop model_loop.sql_variables deferred (seed): 196 where the " + "allow-list expects 195; update the count" + ], + ), + FallbackGateTestCase( + description="upper_bound_allows_fewer_but_not_more", + allow_list=_LIST_HEAD + _VARIABLES_ENTRY + "max_counts = { failure = 5, seed = 200 }\n", + observed={_VARIABLES: {"failure": 6, "seed": 150}}, + run=_SHIPPED_RUN, + expected_problems=[ + "native model_loop model_loop.sql_variables deferred (failure): 6 exceeds the " + "allowed 5" + ], + ), + FallbackGateTestCase( + description="engines_and_corpora_outside_the_run_are_not_checked", + allow_list=_LIST_HEAD + + _VARIABLES_ENTRY + + "counts = { fixture = 4, seed = 195 }\n" + + '\n[[entry]]\nengine = "native-preview"\nstage = "model_analysis"\n' + + 'site = "analysis_session"\nkind = "session"\ncounts = { seed = 1 }\n', + observed={_VARIABLES: {"seed": 195}}, + run=_SHIPPED_RUN, + expected_problems=[], + ), + FallbackGateTestCase( + description="vanished_native_answer_means_the_stage_runs_in_python", + allow_list=_LIST_HEAD + _ANSWER_ENTRY + "counts = { seed = 40 }\n", + observed={}, + run=_SHIPPED_RUN, + expected_problems=[ + "native reference_extraction reference_extraction.native reference_scans (seed): " + "native no longer answers here, so this work now runs in Python; restore the " + "native path, or record the change with a reason" + ], + ), + FallbackGateTestCase( + description="unlisted_native_answer_must_be_recorded", + allow_list=_LIST_HEAD, + observed={_ANSWER: {"seed": 40}}, + run=_SHIPPED_RUN, + expected_problems=[ + "native reference_extraction reference_extraction.native reference_scans (seed): " + "native answered 40, not on the allow-list; record it" + ], + ), + FallbackGateTestCase( + description="other_seed_range_is_refused", + allow_list=_LIST_HEAD, + observed={}, + run=RecordedRun( + engines=("python", "native"), corpora=("seeds",), seed_start=0, seeds=60 + ), + expected_problems=[ + "the allow-list holds counts for --seed-start 0 --seeds 12; this run used " + "--seed-start 0 --seeds 60" + ], + ), + ], + ids=lambda case: case.description, +) +def test_given_allow_list_when_checking_a_run_then_every_difference_is_a_problem( + test_case: FallbackGateTestCase, tmp_path: Path +) -> None: + path: Path = tmp_path / "native_fallbacks.toml" + _ = path.write_text(test_case.allow_list, encoding="utf-8") + + problems: list[str] = fallback_problems( + observed=test_case.observed, allowed=read_allow_list(path), run=test_case.run + ) + + assert problems == test_case.expected_problems + + +@pytest.mark.parametrize( + "test_case", + [ + FallbackRewriteTestCase( + description="other_engines_kept_and_the_run_recounted", + allow_list=_LIST_HEAD + + '\n[[entry]]\nengine = "native-preview"\nstage = "model_analysis"\n' + + 'site = "analysis_session"\nkind = "session"\ncounts = { seed = 1 }\n' + + _VARIABLES_ENTRY + + "counts = { seed = 9 }\n", + observed={_VARIABLES: {"failure": 3, "seed": 195}}, + run=_SHIPPED_RUN, + expected_counts={_SESSION: {"seed": 1}, _VARIABLES: {"failure": 3, "seed": 195}}, + ) + ], + ids=lambda case: case.description, +) +def test_given_recorded_run_when_rewriting_then_other_engines_are_kept_and_the_run_passes( + test_case: FallbackRewriteTestCase, tmp_path: Path +) -> None: + path: Path = tmp_path / "native_fallbacks.toml" + _ = path.write_text(test_case.allow_list, encoding="utf-8") + + write_allow_list(path=path, observed=test_case.observed, run=test_case.run) + + rewritten: AllowList = read_allow_list(path) + assert rewritten.counts == test_case.expected_counts + assert ( + fallback_problems(observed=test_case.observed, allowed=rewritten, run=test_case.run) == [] + ) + + +if __name__ == "__main__": + pytest.main([__file__, "-vv"]) diff --git a/tests/unit/scripts/compiler_differential/_helpers/running/test_records.py b/tests/unit/scripts/compiler_differential/_helpers/running/test_records.py index 2f3a00bccd..ffac8427af 100644 --- a/tests/unit/scripts/compiler_differential/_helpers/running/test_records.py +++ b/tests/unit/scripts/compiler_differential/_helpers/running/test_records.py @@ -1,4 +1,4 @@ -"""Wheel-site and deferral records are summed per engine, site and corpus, never gated.""" +"""Wheel-site, deferral and fallback records are summed per engine, site and corpus.""" from __future__ import annotations @@ -33,16 +33,26 @@ "2-plan/analysis-deferrals-12.jsonl": ( json.dumps({"kind": "legacy_fallback", "site": "compact.py"}) + "\n" ), + "0-compile/native-fallbacks-11.json": json.dumps( + {"fallbacks": [["model_loop.sql_variables", "deferred", 2]]} + ), + "2-plan/native-fallbacks-12.json": json.dumps( + {"fallbacks": [["model_loop.sql_variables", "deferred", 1]]} + ), }, expected_wheel_sites={(_SITE, "parse_one"): 5}, expected_deferrals={("legacy_fallback", "compact.py"): 1}, + expected_fallbacks={("model_loop.sql_variables", "deferred"): 3}, expected_lines=( "Polyglot wheel calls (python):", f" 5 {_SITE} parse_one (seed 5)", "Analysis deferrals (python):", " 1 legacy_fallback compact.py (seed 1)", + "Native-to-Python fallbacks (python):", + " 3 model_loop.sql_variables deferred (seed 3)", "Polyglot wheel calls (native-preview): none recorded", "Analysis deferrals (native-preview): none recorded", + "Native-to-Python fallbacks (native-preview): none recorded", ), ) ], @@ -71,9 +81,10 @@ def test_given_record_files_when_reporting_then_counts_are_summed_per_engine_and ) ) - assert (records.wheel_sites, records.deferrals) == ( + assert (records.wheel_sites, records.deferrals, records.fallbacks) == ( test_case.expected_wheel_sites, test_case.expected_deferrals, + test_case.expected_fallbacks, ) assert report.splitlines() == list(test_case.expected_lines) diff --git a/tests/unit/scripts/compiler_differential/_helpers/running/test_report.py b/tests/unit/scripts/compiler_differential/_helpers/running/test_report.py index 16dc259015..cd1c3f8ee6 100644 --- a/tests/unit/scripts/compiler_differential/_helpers/running/test_report.py +++ b/tests/unit/scripts/compiler_differential/_helpers/running/test_report.py @@ -81,13 +81,15 @@ def test_given_covered_kinds_when_reporting_then_missing_kinds_are_named( description="identical_and_covered", comparisons=[_IDENTICAL], missing_coverage={"discovery": (), "render": ()}, + gate_failures=(), expected_lines=("Compiler differential passed: 1 projects identical",), - expected_absent=("FAILED",), + expected_absent=("FAILED", "make compiler-baselines"), ), SummaryTestCase( description="identical_but_coverage_missing", comparisons=[_IDENTICAL], missing_coverage={"discovery": ("providers", "crlf"), "render": ("path_default",)}, + gate_failures=(), expected_lines=( "Compiler differential FAILED: 0 of 1 projects differ", "Required discovery coverage missing: providers, crlf", @@ -99,11 +101,25 @@ def test_given_covered_kinds_when_reporting_then_missing_kinds_are_named( description="differences_and_coverage_missing", comparisons=[_IDENTICAL, _DIFFERING], missing_coverage={"discovery": ("providers",)}, + gate_failures=(), expected_lines=( "Compiler differential FAILED: 1 of 2 projects differ", "First difference: seed/1: `compile` stdout at /models/0", "Required discovery coverage missing: providers", ), + expected_absent=("passed", "make compiler-baselines"), + ), + SummaryTestCase( + description="gate_failure_says_how_to_record_intended_changes", + comparisons=[_IDENTICAL], + missing_coverage={}, + gate_failures=("native model_loop model_loop.native variable_substitutions (seed)",), + expected_lines=( + "Compiler differential FAILED: 0 of 1 projects differ", + "Native fallback allow-list: 1 problems (listed above)", + "Intended? Run `make compiler-baselines` and commit the changes to " + "scripts/compiler_differential/native_fallbacks.toml and tests/goldens/compiler", + ), expected_absent=("passed",), ), ], @@ -117,6 +133,7 @@ def test_given_results_and_coverage_when_summarizing_then_failures_never_read_as engines=("python", "native"), seconds=2.0, missing_coverage=test_case.missing_coverage, + gate_failures=test_case.gate_failures, ) assert all(line in summary for line in test_case.expected_lines), summary diff --git a/tests/unit/src/sqlbuild/compiler/frontier/_test_types.py b/tests/unit/src/sqlbuild/compiler/frontier/_test_types.py index 232c66c2c5..51aa39f3d7 100644 --- a/tests/unit/src/sqlbuild/compiler/frontier/_test_types.py +++ b/tests/unit/src/sqlbuild/compiler/frontier/_test_types.py @@ -5,7 +5,12 @@ from collections.abc import Callable from dataclasses import dataclass -from sqlbuild.compiler.frontier.types import CompilerEngine, CompilerStage, NativeStage +from sqlbuild.compiler.frontier.types import ( + CompilerEngine, + CompilerStage, + NativeFallbackSite, + NativeStage, +) @dataclass(frozen=True) @@ -143,3 +148,12 @@ class NativeStageCouplingTestCase: dependent: NativeStage dependency: NativeStage expected_engines_without_dependency: frozenset[CompilerEngine] + + +@dataclass(frozen=True) +class NativeFallbackRecorderTestCase: + """Fallbacks one process records and the record file it writes at exit.""" + + description: str + recorded: tuple[tuple[NativeFallbackSite, str], ...] + expected_files: list[list[list[object]]] diff --git a/tests/unit/src/sqlbuild/compiler/frontier/test_native_fallback_recorder.py b/tests/unit/src/sqlbuild/compiler/frontier/test_native_fallback_recorder.py new file mode 100644 index 0000000000..ef6d634e54 --- /dev/null +++ b/tests/unit/src/sqlbuild/compiler/frontier/test_native_fallback_recorder.py @@ -0,0 +1,64 @@ +"""Native-to-Python fallbacks are counted per site and kind and written once per process.""" + +from __future__ import annotations + +import json +import os +from pathlib import Path + +import pytest + +from sqlbuild.compiler.frontier.classes.native_fallback_recorder import NativeFallbackRecorder +from sqlbuild.compiler.frontier.constants import NATIVE_FALLBACK_RECORD_PREFIX +from sqlbuild.compiler.frontier.types import NativeFallbackSite +from tests.unit.src.sqlbuild.compiler.frontier._test_types import NativeFallbackRecorderTestCase + + +@pytest.mark.parametrize( + "test_case", + [ + NativeFallbackRecorderTestCase( + description="counts_per_site_and_kind_sorted", + recorded=( + (NativeFallbackSite.SQL_VARIABLES, "deferred"), + (NativeFallbackSite.REFERENCE_SCAN, "deferred"), + (NativeFallbackSite.SQL_VARIABLES, "deferred"), + (NativeFallbackSite.SQL_VARIABLES, "error"), + ), + expected_files=[ + [ + ["model_loop.sql_variables", "deferred", 2], + ["model_loop.sql_variables", "error", 1], + ["reference_extraction.scan", "deferred", 1], + ] + ], + ), + NativeFallbackRecorderTestCase( + description="no_fallback_writes_no_file", + recorded=(), + expected_files=[], + ), + ], + ids=lambda case: case.description, +) +def test_given_recorded_fallbacks_when_writing_then_one_file_holds_their_counts( + test_case: NativeFallbackRecorderTestCase, tmp_path: Path +) -> None: + recorder: NativeFallbackRecorder = NativeFallbackRecorder(directory=tmp_path / "records") + for site, kind in test_case.recorded: + recorder.record(site=site.value, kind=kind) + + recorder.write() + + written: list[list[list[object]]] = [ + json.loads(path.read_text(encoding="utf-8"))["fallbacks"] + for path in sorted((tmp_path / "records").glob(f"{NATIVE_FALLBACK_RECORD_PREFIX}*")) + ] + assert [path.name for path in (tmp_path / "records").glob("*")] == [ + f"{NATIVE_FALLBACK_RECORD_PREFIX}{os.getpid()}.json" + ] * len(test_case.expected_files) + assert written == test_case.expected_files + + +if __name__ == "__main__": + pytest.main([__file__, "-vv"])