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

Support SELECT * EXCEPT(col1, col2, ...) for BigQueryDialect #687

Closed
unvalley opened this issue Oct 25, 2022 · 4 comments · Fixed by #745
Closed

Support SELECT * EXCEPT(col1, col2, ...) for BigQueryDialect #687

unvalley opened this issue Oct 25, 2022 · 4 comments · Fixed by #745

Comments

@unvalley
Copy link
Contributor

unvalley commented Oct 25, 2022

I’d like to parse SELECT [* | column.*] EXCEPT(col1, col2, ...) FROM table using BigQueryDialect.

BigQuery Reference: https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select_except

The query SELECT * EXCEPT (col1, col2) FROM table causes ParserError as I described below.

use sqlparser::dialect::BigQueryDialect;
use sqlparser::parser::*;

fn main() {
    let sql = "SELECT * EXCEPT (col1, col2) FROM table";
    let dialect = BigQueryDialect {};
    let ast = Parser::parse_sql(&dialect, sql).unwrap();
    println!("AST: {:?}", ast);
}

// output: 
// thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParserError("Expected SELECT, VALUES, or a subquery in the query body, found: col1")', examples/parse_select.rs:21:48...
@unvalley unvalley changed the title Support SELECT * EXCEPT(col1, col2, ...) for BigQuery Support SELECT * EXCEPT(col1, col2, ...) for BigQueryDialect Oct 25, 2022
@AugustoFKL
Copy link
Contributor

@unvalley are you working on this already?

I just worked on EXCLUDE from snowflake on #721, and it seems like a really similar syntax. I can work on that as well.

@unvalley
Copy link
Contributor Author

unvalley commented Nov 21, 2022

@AugustoFKL I'm not working on this.

I just worked on EXCLUDE from snowflake on #721, and it seems like a really similar syntax. I can work on that as well.

Thanks! That helps a lot.

@AugustoFKL
Copy link
Contributor

Sure, I'll do that then. I just need to have my 5 PRs merged hahaha, otherwise I'll start pilling up conflicts, which I don't have the love of solving.

Once 2 or 3 are merged, I can go on that. Does that work for you?

@unvalley
Copy link
Contributor Author

@AugustoFKL No problem at all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants