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

Bug: Create view doesn't work with a select statement in parentheses #2636

Closed
talagluck opened this issue Feb 12, 2024 · 0 comments · Fixed by #2637
Closed

Bug: Create view doesn't work with a select statement in parentheses #2636

talagluck opened this issue Feb 12, 2024 · 0 comments · Fixed by #2637
Assignees
Labels
bug Something isn't working

Comments

@talagluck
Copy link
Contributor

Description

This works

CREATE TABLE table_no_paren AS SELECT 1;

and this works

CREATE VIEW view_no_paren AS SELECT 1;

and this works

CREATE TABLE table_yes_paren AS (SELECT 1);

but this doesn't work

CREATE VIEW view_yes_paren AS (SELECT 1);

It raises

Query failed to run.

Invalid view statement: view body must either be a SELECT or VALUES statement

This is an issue because of the way that dbt works - by default it takes the dbt code that you write and renders queries with the select statement in parentheses, and by default, it uses views rather than tables for efficiency purposes.

@talagluck talagluck added the bug Something isn't working label Feb 12, 2024
@universalmind303 universalmind303 self-assigned this Feb 12, 2024
universalmind303 added a commit that referenced this issue Feb 12, 2024
tychoish pushed a commit that referenced this issue Feb 15, 2024
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.

2 participants