question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Star macro syntax error

See original GitHub issue

While developing a model in 0.12.1 and 0.12.2 we have run into an issue with the dbt_utils.star macro. We are using an Amazon Redshift database. We received the following error:

Found 106 models, 80 tests, 0 archives, 0 analyses, 201 macros, 2 operations, 0 seed files

14:38:12 | Concurrency: 1 threads (target='test_db')
14:38:12 | 
14:38:12 | 1 of 1 START table model public.star_example......................... [RUN]
14:38:21 | 1 of 1 ERROR creating table model public.star_example................ [ERROR in 8.92s]
14:38:21 | 
14:38:21 | Finished running 1 table models in 11.72s.

Completed with 1 errors:

Database Error in model star_example (models/dbt-util-issue/star_example.sql)
  syntax error at or near "FROM"
  LINE 16: FROM __dbt__CTE__underlying_data
           ^
  compiled SQL at target/compiled/fulla/dbt-util-issue/star_example.sql

In our situation, dbt will throw a syntax error if the macro is the only field stated in the SELECT statement. Here is a minimal, reproducible example:

# star_example.sql

{{
  config(
    materialized = 'table'
  )
}}

SELECT
  {{ dbt_utils.star(from = ref('underlying_data'), except = ["team"]) }}
FROM {{ ref ('underlying_data') }}

# underlying_data.sql

{{
  config(
    materialized = 'ephemeral'
  )
}}

SELECT
  'patrick' AS name,
  1 AS team

Here is the compiled code:

# star_example.sql (compiled)


with __dbt__CTE__underlying_data as (


SELECT
  'patrick' AS name,
  1 AS team
)SELECT
  
FROM __dbt__CTE__underlying_data

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
drewbanincommented, Jan 8, 2019

(I’d recommend making underlying_data.sql a view model here if you’re intent on using the star macro)

1reaction
drewbanincommented, Jan 8, 2019

Thanks for the report @patdough5. The star macro uses the information_schema.columns table to find all of the columns in a relation. As such, it definitely won’t work with an ephemeral model. I’ve long had an item on my todo list to 1) throw an error message if an ephemeral model is passed to star and 2) update the docs accordingly.

Let’s leave this issue open and use it to track these changes. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Star macro syntax error · Issue #111 · dbt-labs/dbt-utils - GitHub
While developing a model in 0.12.1 and 0.12.2 we have run into an issue with the dbt_utils.star macro. We are using an Amazon...
Read more >
Syntax Error VBA - Automate Excel
Cynthia R. May 22, 2021. star. Read all reviews ... VBA – Modify the Right-Click Menu to Call a Macro · VBA –...
Read more >
Syntax error when passing variable args in macro
I believe it is complaining about the ParamArray keyword. After a little digging, I discovered you need to include: option compatible.
Read more >
Solved: macro syntax error - Programming - SAS Communities
Hi,. I want to assign to first and last date as macro. my code is below but give me syntax error. How can...
Read more >
Syntax Parse Examples - Racket Documentation
The let-star macro implements let* in terms of let. ... If name is used outside of a macro then a syntax error is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found