From 2352fa0361c259d983cbdbecb253970581093580 Mon Sep 17 00:00:00 2001 From: Natalie Fiann Date: Wed, 2 Oct 2024 14:43:57 +0100 Subject: [PATCH 1/4] Updated build guide --- website/docs/reference/commands/build.md | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/website/docs/reference/commands/build.md b/website/docs/reference/commands/build.md index ae5e5805c31..5f6e78c9990 100644 --- a/website/docs/reference/commands/build.md +++ b/website/docs/reference/commands/build.md @@ -31,6 +31,32 @@ In DAG order, for selected resources or an entire project. The `build` command supports the `--empty` flag for building schema-only dry runs. The `--empty` flag limits the refs and sources to zero rows. dbt will still execute the model SQL against the target data warehouse but will avoid expensive reads of input data. This validates dependencies and ensures your models will build properly. +#### SQL compilation error when running the `--empty flag` on model + +If you encounter the error: `the error SQL compilation error: syntax error line 1 at position 21 unexpected '('.` when running a model with the `--empty flag`, explicitly call the `.render()` method on that relation. + + + + +```Jinja + +-- models/staging/stg_sys__customers.sql +{{ config( + pre_hook = [ + "alter external table {{ source('sys', 'customers').render() }} refresh" + ] +) }} + +with cus as ( + select * from {{ source("sys", "customers") }} -- leave this as is! +) + +select * from cus + +``` + + + ## Tests From b9a1b87765990789907bd51f98f35a2940ef7ab0 Mon Sep 17 00:00:00 2001 From: Natalie Fiann Date: Wed, 2 Oct 2024 14:50:31 +0100 Subject: [PATCH 2/4] Corrected typo --- website/docs/reference/commands/build.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/reference/commands/build.md b/website/docs/reference/commands/build.md index 5f6e78c9990..e666021cac8 100644 --- a/website/docs/reference/commands/build.md +++ b/website/docs/reference/commands/build.md @@ -33,7 +33,7 @@ The `build` command supports the `--empty` flag for building schema-only dry run #### SQL compilation error when running the `--empty flag` on model -If you encounter the error: `the error SQL compilation error: syntax error line 1 at position 21 unexpected '('.` when running a model with the `--empty flag`, explicitly call the `.render()` method on that relation. +If you encounter the error: `SQL compilation error: syntax error line 1 at position 21 unexpected '('.` when running a model with the `--empty flag`, explicitly call the `.render()` method on that relation. From 521748563fb1aea530e6190fa03da593778962b8 Mon Sep 17 00:00:00 2001 From: nataliefiann <120089939+nataliefiann@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:16:35 +0100 Subject: [PATCH 3/4] Update website/docs/reference/commands/build.md Co-authored-by: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> --- website/docs/reference/commands/build.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/reference/commands/build.md b/website/docs/reference/commands/build.md index e666021cac8..7e876aae9d8 100644 --- a/website/docs/reference/commands/build.md +++ b/website/docs/reference/commands/build.md @@ -31,7 +31,7 @@ In DAG order, for selected resources or an entire project. The `build` command supports the `--empty` flag for building schema-only dry runs. The `--empty` flag limits the refs and sources to zero rows. dbt will still execute the model SQL against the target data warehouse but will avoid expensive reads of input data. This validates dependencies and ensures your models will build properly. -#### SQL compilation error when running the `--empty flag` on model +#### SQL compilation error when running the `--empty` flag on a model If you encounter the error: `SQL compilation error: syntax error line 1 at position 21 unexpected '('.` when running a model with the `--empty flag`, explicitly call the `.render()` method on that relation. From 1565e7660ee437f7b3efd9a093d42b6acee944e3 Mon Sep 17 00:00:00 2001 From: nataliefiann <120089939+nataliefiann@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:16:59 +0100 Subject: [PATCH 4/4] Update website/docs/reference/commands/build.md Co-authored-by: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> --- website/docs/reference/commands/build.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/reference/commands/build.md b/website/docs/reference/commands/build.md index 7e876aae9d8..c7ac29862c2 100644 --- a/website/docs/reference/commands/build.md +++ b/website/docs/reference/commands/build.md @@ -33,7 +33,7 @@ The `build` command supports the `--empty` flag for building schema-only dry run #### SQL compilation error when running the `--empty` flag on a model -If you encounter the error: `SQL compilation error: syntax error line 1 at position 21 unexpected '('.` when running a model with the `--empty flag`, explicitly call the `.render()` method on that relation. +If you encounter the error: `SQL compilation error: syntax error line 1 at position 21 unexpected '('.` when running a model with the `--empty` flag, explicitly call the `.render()` method on that relation.