Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update execute.md #5198

Merged
merged 11 commits into from
Apr 10, 2024
24 changes: 12 additions & 12 deletions website/docs/reference/dbt-jinja-functions/execute.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ Any Jinja that relies on a result being returned from the database will error du
<File name='models/order_payment_methods.sql'>

```sql
{% set payment_method_query %}
select distinct
payment_method
from {{ ref('raw_payments') }}
order by 1
{% endset %}

{% set results = run_query(payment_method_query) %}

{# Return the first column #}
{% set payment_methods = results.columns[0].values() %}
1 {% set payment_method_query %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

completely agree @ialdg with you, added line numbers here for ease. thanks for that sugg!

2 select distinct
3 payment_method
4 from {{ ref('raw_payments') }}
5 order by 1
6 {% endset %}
7
8 {% set results = run_query(payment_method_query) %}
9
10 {# Return the first column #}
11 {% set payment_methods = results.columns[0].values() %}

```

Expand Down Expand Up @@ -55,8 +55,8 @@ order by 1
{% endset %}

mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
{% set results = run_query(payment_method_query) %}

{% if execute %}
{% set results = run_query(payment_method_query) %}
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
{# Return the first column #}
{% set payment_methods = results.columns[0].values() %}
{% else %}
Expand Down
Loading