dbt-utils icon indicating copy to clipboard operation
dbt-utils copied to clipboard

run_query macro throws syntax error with each example I try

Open vincentclaes opened this issue 4 months ago • 0 comments

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?

  • [*] postgres
  • [ ] redshift
  • [ ] bigquery
  • [ ] snowflake
  • [ ] other (specify: ____________)

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?

vincentclaes avatar Mar 22 '24 16:03 vincentclaes