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

"Expecting )" error when using named args @STAR(tbl, except := [col]) #2599

Closed
anentropic opened this issue May 13, 2024 · 4 comments · Fixed by #2604
Closed

"Expecting )" error when using named args @STAR(tbl, except := [col]) #2599

anentropic opened this issue May 13, 2024 · 4 comments · Fixed by #2604
Assignees
Labels
Bug Something isn't working

Comments

@anentropic
Copy link
Contributor

https://sqlmesh.readthedocs.io/en/stable/concepts/macros/sqlmesh_macros/#star

For example, we might omit the alias argument with @STAR(foo, except := [c])

But I get an error:

Error: Failed to parse a model definition at '/Users/anentropic/dev/etl/models/orders.sql': Expecting ). Line 51, Col: 28.
  _TRG_USERACCESS_D
        )
    order by W_INSERT_DATE, ORDER_WID
)
select
    @STAR(ranked_orders, except := [row_num])
from ranked_orders
where
    row_num = 1
    and snowflake_last_ingested_at between @.

omitting the except := [row_num] allows the plan to work

I'm on sqlmesh 0.95.1 and if I look at the files in my virtualenv I appear to have the changes from this PR #2484

@z3z1ma
Copy link
Contributor

z3z1ma commented May 13, 2024

If the keyword name shadows a sql keyword, you'll likely need to quote it. So "except" := [c]

@georgesittas
Copy link
Contributor

georgesittas commented May 13, 2024

This needs to be except_, it seems like there's a typo in the docs.

@anentropic
Copy link
Contributor Author

then I get:

TypeError: star() got multiple values for argument 'except_'

from this code:

select
    @STAR(ranked_orders, except_ := [row_num])
from ranked_orders
where row_num = 1

@georgesittas
Copy link
Contributor

gotcha thanks, will take a look 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants