From 8c3a0145d8b36d9de7d3bb93c4ab9110dc6f3fe2 Mon Sep 17 00:00:00 2001 From: Doug Beatty <44704949+dbeatty10@users.noreply.github.com> Date: Thu, 30 May 2024 09:27:04 -0600 Subject: [PATCH] Link to docs for `print()` macro (#5581) ## Previews - [Suppress non-error logs in output](https://docs-getdbt-com-git-dbeatty-print-function-hyperlinks-dbt-labs.vercel.app//reference/global-configs/logs#suppress-non-error-logs-in-output) - [Suppress print() messages in stdout](https://docs-getdbt-com-git-dbeatty-print-function-hyperlinks-dbt-labs.vercel.app//reference/global-configs/print-output#suppress-print-messages-in-stdout) - [print() support in dbt Python models](https://docs-getdbt-com-git-dbeatty-print-function-hyperlinks-dbt-labs.vercel.app//docs/build/python-models#limitations) ## What are you changing in this pull request and why? Two things: - Link to [dbt's `print()`](https://docs.getdbt.com/reference/dbt-jinja-functions/print) macro (where relevant) - Link to docs for [Python's built-in `print()`](https://docs.python.org/3/library/functions.html#print) function to differentiate it from [dbt's `print()`](https://docs.getdbt.com/reference/dbt-jinja-functions/print) macro ## Checklist - [x] Review the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) so my content adheres to these guidelines. --- website/docs/docs/build/python-models.md | 2 +- website/docs/reference/global-configs/logs.md | 4 ++-- website/docs/reference/global-configs/print-output.md | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/website/docs/docs/build/python-models.md b/website/docs/docs/build/python-models.md index 5cd31ae9719..213d588790b 100644 --- a/website/docs/docs/build/python-models.md +++ b/website/docs/docs/build/python-models.md @@ -597,7 +597,7 @@ Python models have capabilities that SQL models do not. They also have some draw - **Time and cost.** Python models are slower to run than SQL models, and the cloud resources that run them can be more expensive. Running Python requires more general-purpose compute. That compute might sometimes live on a separate service or architecture from your SQL models. **However:** We believe that deploying Python models via dbt—with unified lineage, testing, and documentation—is, from a human standpoint, **dramatically** faster and cheaper. By comparison, spinning up separate infrastructure to orchestrate Python transformations in production and different tooling to integrate with dbt is much more time-consuming and expensive. - **Syntax differences** are even more pronounced. Over the years, dbt has done a lot, via dispatch patterns and packages such as `dbt_utils`, to abstract over differences in SQL dialects across popular data warehouses. Python offers a **much** wider field of play. If there are five ways to do something in SQL, there are 500 ways to write it in Python, all with varying performance and adherence to standards. Those options can be overwhelming. As the maintainers of dbt, we will be learning from state-of-the-art projects tackling this problem and sharing guidance as we develop it. - **These capabilities are very new.** As data warehouses develop new features, we expect them to offer cheaper, faster, and more intuitive mechanisms for deploying Python transformations. **We reserve the right to change the underlying implementation for executing Python models in future releases.** Our commitment to you is around the code in your model `.py` files, following the documented capabilities and guidance we're providing here. -- **Lack of `print()` support.** The data platform runs and compiles your Python model without dbt's oversight. This means it doesn't display the output of commands such as `print()` in dbt's logs. +- **Lack of `print()` support.** The data platform runs and compiles your Python model without dbt's oversight. This means it doesn't display the output of commands such as Python's built-in [`print()`](https://docs.python.org/3/library/functions.html#print) function in dbt's logs. As a general rule, if there's a transformation you could write equally well in SQL or Python, we believe that well-written SQL is preferable: it's more accessible to a greater number of colleagues, and it's easier to write code that's performant at scale. If there's a transformation you _can't_ write in SQL, or where ten lines of elegant and well-annotated Python could save you 1000 lines of hard-to-read Jinja-SQL, Python is the way to go. diff --git a/website/docs/reference/global-configs/logs.md b/website/docs/reference/global-configs/logs.md index fc96d718ae9..7ee7890e302 100644 --- a/website/docs/reference/global-configs/logs.md +++ b/website/docs/reference/global-configs/logs.md @@ -131,7 +131,7 @@ Just like other global configs, it is possible to override these values for your ### Suppress non-error logs in output -By default, dbt shows all logs in standard out (stdout). You can use the `QUIET` config to show only error logs in stdout. Logs will still include the output of anything passed to the `print()` macro. For example, you might suppress all but error logs to more easily find and debug a jinja error. +By default, dbt shows all logs in standard out (stdout). You can use the `QUIET` config to show only error logs in stdout. Logs will still include the output of anything passed to the [`print()`](/reference/dbt-jinja-functions/print) macro. For example, you might suppress all but error logs to more easily find and debug a jinja error. @@ -157,7 +157,7 @@ In [dbt version 1.5](/docs/dbt-versions/core-upgrade/upgrading-to-v1.5#behavior- You can use either of these parameters to ensure clean output that's compatible with downstream processes, such as piping results to [`jq`](https://jqlang.github.io/jq/manual/), a file, or another process: - `dbt --log-level warn list` (recommended; equivalent to previous default) -- `dbt --quiet list` (suppresses all logging less than ERROR level, except for "printed" messages and list output) +- `dbt --quiet list` (suppresses all logging less than `ERROR` level, except for "printed" messages and list output) ### Logging relational cache events diff --git a/website/docs/reference/global-configs/print-output.md b/website/docs/reference/global-configs/print-output.md index 78de635f2dd..1d44a8bc5f0 100644 --- a/website/docs/reference/global-configs/print-output.md +++ b/website/docs/reference/global-configs/print-output.md @@ -8,13 +8,13 @@ sidebar: "Print output" -By default, dbt includes `print()` messages in standard out (stdout). You can use the `DBT_NO_PRINT` environment variable to prevent these messages from showing up in stdout. +By default, dbt includes [`print()`](/reference/dbt-jinja-functions/print) messages in standard out (stdout). You can use the `DBT_NO_PRINT` environment variable to prevent these messages from showing up in stdout. -By default, dbt includes `print()` messages in standard out (stdout). You can use the `DBT_PRINT` environment variable to prevent these messages from showing up in stdout. +By default, dbt includes [`print()`](/reference/dbt-jinja-functions/print) messages in standard out (stdout). You can use the `DBT_PRINT` environment variable to prevent these messages from showing up in stdout. :::warning Syntax deprecation