dbt-labs / dbt-utils

Utility functions for dbt projects.
https://hub.getdbt.com/dbt-labs/dbt_utils/latest/
Apache License 2.0
1.34k stars 488 forks source link

run_query macro throws syntax error with each example I try #878

Open vincentclaes opened 6 months ago

vincentclaes commented 6 months ago

Describe the bug

run_query macro produces the same error on every query I try

Database Error in model testcard_id_audit (models/audit/foo.sql)
  syntax error at or near ")"
  LINE 13:   );
             ^

Even with this trivial example :

{% if execute %}

    {% set results = run_query('select 1 as id') %}
    {% do results.print_table() %}

{% endif %}

Steps to reproduce

Add this to a model

{% if execute %}

    {% set results = run_query('select 1 as id') %}
    {% do results.print_table() %}

{% endif %}

and perform dbt run

Expected results

I would expect no error and a table that is returned I can print for example.

Actual results

Database Error in model testcard_id_audit (models/audit/foo.sql)
  syntax error at or near ")"
  LINE 13:   );

Screenshots and log output

System information

The contents of your packages.yml file:

Which database are you using dbt with?

The output of dbt --version:

 dbt --version                                                                                                                                              1 ↵  ✖ ✹ ✚ ✭SF-1280-remove-unused-models  
Core:
  - installed: 1.7.10
  - latest:    1.7.10 - Up to date!

Plugins:
  - postgres: 1.7.10 - Up to date!

Additional context

Are you interested in contributing the fix?

github-actions[bot] commented 4 days ago

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.