Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/dialect/bigquery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ impl Dialect for BigQueryDialect {
true
}

/// BigQuery allows a query to start with `FROM` (e.g. `FROM t`, and the
/// entry form for pipe syntax, `FROM t |> ...`).
///
/// See <https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#from_queries>
fn supports_from_first_select(&self) -> bool {
true
}

/// See <https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#execute_immediate>
fn supports_execute_immediate(&self) -> bool {
true
Expand Down
7 changes: 7 additions & 0 deletions tests/sqlparser_bigquery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2950,3 +2950,10 @@ fn test_create_snapshot_table() {
"CREATE SNAPSHOT TABLE IF NOT EXISTS dataset_id.table1 CLONE dataset_id.table2 FOR SYSTEM_TIME AS OF TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR) OPTIONS(expiration_timestamp = TIMESTAMP '2025-01-01 00:00:00 UTC')",
);
}

#[test]
fn parse_from_first_select() {
bigquery().verified_stmt("FROM t");
bigquery().verified_stmt("FROM t SELECT a, b");
bigquery().verified_stmt("FROM t |> WHERE a > 1 |> SELECT a");
}
Loading