Skip to content

feat: support export data for bigquery #1976

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

chenkovsky
Copy link
Contributor

No description provided.

/// EXPORT DATA OPTIONS(uri='gs://bucket/folder/*', format='PARQUET', overwrite=true) AS
/// SELECT field1, field2 FROM mydataset.table1 ORDER BY field1 LIMIT 10
/// ```
ExportData(ExportData),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a link to the bigquery docs where the syntax comes from?

@@ -645,6 +645,7 @@ impl<'a> Parser<'a> {
Keyword::COMMENT if self.dialect.supports_comment_on() => self.parse_comment(),
Keyword::PRINT => self.parse_print(),
Keyword::RETURN => self.parse_return(),
Keyword::EXPORT => self.parse_export(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we do similar to here where we call prev_token() so that the parse-export() function is stand alone and able to parse a complete statement?

@@ -16510,6 +16511,27 @@ impl<'a> Parser<'a> {
}
}

fn parse_export(&mut self) -> Result<Statement, ParserError> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn parse_export(&mut self) -> Result<Statement, ParserError> {
fn parse_export_date(&mut self) -> Result<Statement, ParserError> {

Could we also add a short description mentioning that this parses a Statement::ExportData statement? For example

@@ -2566,3 +2566,24 @@ fn test_struct_trailing_and_nested_bracket() {
)
);
}

#[test]
fn test_export() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this introduces a new statement, can we include an assertion on the AST for one of the statements, checking that the returned AST looks like what we expect? For example

Also could we add coverage for some scenarios like the following?

"EXPORT DATA OPTIONS()";
"EXPORT DATA AS SELECT ...";
"EXPORT DATA WITH CONNECTION ... AS SELECT ..."

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 this pull request may close these issues.

2 participants