BigQuery: support of CREATE VIEW IF NOT EXISTS (#1118)

This commit is contained in:
Aleksei Piianin 2024-02-04 14:59:03 +01:00 committed by GitHub
parent 8fae601743
commit 60baea4ae7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 1 deletions

View file

@ -175,6 +175,36 @@ fn parse_create_view_with_options() {
_ => unreachable!(),
}
}
#[test]
fn parse_create_view_if_not_exists() {
let sql = "CREATE VIEW IF NOT EXISTS mydataset.newview AS SELECT foo FROM bar";
match bigquery().verified_stmt(sql) {
Statement::CreateView {
name,
columns,
query,
or_replace,
materialized,
options,
cluster_by,
with_no_schema_binding: late_binding,
if_not_exists,
temporary,
} => {
assert_eq!("mydataset.newview", name.to_string());
assert_eq!(Vec::<ViewColumnDef>::new(), columns);
assert_eq!("SELECT foo FROM bar", query.to_string());
assert!(!materialized);
assert!(!or_replace);
assert_eq!(options, CreateTableOptions::None);
assert_eq!(cluster_by, vec![]);
assert!(!late_binding);
assert!(if_not_exists);
assert!(!temporary);
}
_ => unreachable!(),
}
}
#[test]
fn parse_create_table_with_options() {