Star macro syntax error
See original GitHub issueWhile 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:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
(I’d recommend making
underlying_data.sql
aview
model here if you’re intent on using thestar
macro)Thanks for the report @patdough5. The
star
macro uses theinformation_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 anephemeral
model is passed tostar
and 2) update the docs accordingly.Let’s leave this issue open and use it to track these changes. Thanks!