@@ -29,7 +29,7 @@ use crate::ast::{
2929 DistStyle , Expr , FileFormat , ForValues , HiveDistributionStyle , HiveFormat , Ident ,
3030 InitializeKind , ObjectName , OnCommit , OneOrManyWithParens , Query , RefreshModeKind ,
3131 RowAccessPolicy , Statement , StorageLifecyclePolicy , StorageSerializationPolicy ,
32- TableConstraint , TableVersion , Tag , WrappedCollection ,
32+ TableConstraint , TableVersion , Tag , WithData , WrappedCollection ,
3333} ;
3434
3535use crate :: parser:: ParserError ;
@@ -157,6 +157,9 @@ pub struct CreateTableBuilder {
157157 pub base_location : Option < String > ,
158158 /// Optional external volume identifier.
159159 pub external_volume : Option < String > ,
160+ /// `WITH CONNECTION` clause.
161+ /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_external_table_statement)
162+ pub with_connection : Option < ObjectName > ,
160163 /// Optional catalog name.
161164 pub catalog : Option < String > ,
162165 /// Optional catalog synchronization option.
@@ -183,6 +186,12 @@ pub struct CreateTableBuilder {
183186 pub sortkey : Option < Vec < Expr > > ,
184187 /// Redshift `BACKUP` option.
185188 pub backup : Option < bool > ,
189+ /// `MULTISET | SET` table-kind prefix.
190+ pub multiset : Option < bool > ,
191+ /// `FALLBACK` clause.
192+ pub fallback : Option < bool > ,
193+ /// `WITH DATA` clause.
194+ pub with_data : Option < WithData > ,
186195}
187196
188197impl CreateTableBuilder {
@@ -235,6 +244,7 @@ impl CreateTableBuilder {
235244 with_tags : None ,
236245 base_location : None ,
237246 external_volume : None ,
247+ with_connection : None ,
238248 catalog : None ,
239249 catalog_sync : None ,
240250 storage_serialization_policy : None ,
@@ -248,6 +258,9 @@ impl CreateTableBuilder {
248258 distkey : None ,
249259 sortkey : None ,
250260 backup : None ,
261+ multiset : None ,
262+ fallback : None ,
263+ with_data : None ,
251264 }
252265 }
253266 /// Set `OR REPLACE` for the CREATE TABLE statement.
@@ -488,6 +501,11 @@ impl CreateTableBuilder {
488501 self . external_volume = external_volume;
489502 self
490503 }
504+ /// Set the `WITH CONNECTION` clause.
505+ pub fn with_connection ( mut self , with_connection : Option < ObjectName > ) -> Self {
506+ self . with_connection = with_connection;
507+ self
508+ }
491509 /// Set the catalog name for the table.
492510 pub fn catalog ( mut self , catalog : Option < String > ) -> Self {
493511 self . catalog = catalog;
@@ -556,6 +574,22 @@ impl CreateTableBuilder {
556574 self . backup = backup;
557575 self
558576 }
577+ /// Set `MULTISET | SET` table-kind prefix.
578+ /// Some(true) => `MULTISET`, Some(false) => `SET`.
579+ pub fn multiset ( mut self , multiset : Option < bool > ) -> Self {
580+ self . multiset = multiset;
581+ self
582+ }
583+ /// Set `FALLBACK` / `NO FALLBACK` flag.
584+ pub fn fallback ( mut self , fallback : Option < bool > ) -> Self {
585+ self . fallback = fallback;
586+ self
587+ }
588+ /// Set `WITH DATA` clause.
589+ pub fn with_data ( mut self , with_data : Option < WithData > ) -> Self {
590+ self . with_data = with_data;
591+ self
592+ }
559593 /// Consume the builder and produce a `CreateTable`.
560594 pub fn build ( self ) -> CreateTable {
561595 CreateTable {
@@ -605,6 +639,7 @@ impl CreateTableBuilder {
605639 with_tags : self . with_tags ,
606640 base_location : self . base_location ,
607641 external_volume : self . external_volume ,
642+ with_connection : self . with_connection ,
608643 catalog : self . catalog ,
609644 catalog_sync : self . catalog_sync ,
610645 storage_serialization_policy : self . storage_serialization_policy ,
@@ -618,6 +653,9 @@ impl CreateTableBuilder {
618653 distkey : self . distkey ,
619654 sortkey : self . sortkey ,
620655 backup : self . backup ,
656+ multiset : self . multiset ,
657+ fallback : self . fallback ,
658+ with_data : self . with_data ,
621659 }
622660 }
623661}
@@ -686,6 +724,7 @@ impl From<CreateTable> for CreateTableBuilder {
686724 with_tags : table. with_tags ,
687725 base_location : table. base_location ,
688726 external_volume : table. external_volume ,
727+ with_connection : table. with_connection ,
689728 catalog : table. catalog ,
690729 catalog_sync : table. catalog_sync ,
691730 storage_serialization_policy : table. storage_serialization_policy ,
@@ -699,6 +738,9 @@ impl From<CreateTable> for CreateTableBuilder {
699738 distkey : table. distkey ,
700739 sortkey : table. sortkey ,
701740 backup : table. backup ,
741+ multiset : table. multiset ,
742+ fallback : table. fallback ,
743+ with_data : table. with_data ,
702744 }
703745 }
704746}
0 commit comments