Skip to main content

CreateTable

Struct CreateTable 

Source
pub struct CreateTable {
Show 31 fields pub name: TableRef, pub on_cluster: Option<OnCluster>, pub columns: Vec<ColumnDef>, pub constraints: Vec<TableConstraint>, pub if_not_exists: bool, pub temporary: bool, pub or_replace: bool, pub table_modifier: Option<String>, pub as_select: Option<Expression>, pub as_select_parenthesized: bool, pub on_commit: Option<OnCommit>, pub clone_source: Option<TableRef>, pub clone_at_clause: Option<Expression>, pub is_copy: bool, pub shallow_clone: bool, pub leading_comments: Vec<String>, pub with_properties: Vec<(String, String)>, pub teradata_post_name_options: Vec<String>, pub with_data: Option<bool>, pub with_statistics: Option<bool>, pub teradata_indexes: Vec<TeradataIndex>, pub with_cte: Option<With>, pub properties: Vec<Expression>, pub partition_of: Option<Expression>, pub post_table_properties: Vec<Expression>, pub mysql_table_options: Vec<(String, String)>, pub inherits: Vec<TableRef>, pub on_property: Option<OnProperty>, pub copy_grants: bool, pub using_template: Option<Box<Expression>>, pub rollup: Option<RollupProperty>,
}
Expand description

CREATE TABLE statement

Fields§

§name: TableRef§on_cluster: Option<OnCluster>

ClickHouse: ON CLUSTER clause for distributed DDL

§columns: Vec<ColumnDef>§constraints: Vec<TableConstraint>§if_not_exists: bool§temporary: bool§or_replace: bool§table_modifier: Option<String>

Table modifier: DYNAMIC, ICEBERG, EXTERNAL, HYBRID (Snowflake)

§as_select: Option<Expression>§as_select_parenthesized: bool

Whether the AS SELECT was wrapped in parentheses

§on_commit: Option<OnCommit>

ON COMMIT behavior for temporary tables

§clone_source: Option<TableRef>

Clone source table (e.g., CREATE TABLE t CLONE source_table)

§clone_at_clause: Option<Expression>

Time travel AT/BEFORE clause for CLONE (e.g., AT(TIMESTAMP => ‘…’))

§is_copy: bool

Whether this is a COPY operation (BigQuery) vs CLONE (Snowflake/Databricks)

§shallow_clone: bool

Whether this is a SHALLOW CLONE (Databricks/Delta Lake)

§leading_comments: Vec<String>

Leading comments before the statement

§with_properties: Vec<(String, String)>

WITH properties (e.g., WITH (FORMAT=‘parquet’))

§teradata_post_name_options: Vec<String>

Teradata: table options after name before columns (comma-separated)

§with_data: Option<bool>

Teradata: WITH DATA (true) or WITH NO DATA (false) after AS SELECT

§with_statistics: Option<bool>

Teradata: AND STATISTICS (true) or AND NO STATISTICS (false)

§teradata_indexes: Vec<TeradataIndex>

Teradata: Index specifications (NO PRIMARY INDEX, UNIQUE PRIMARY INDEX, etc.)

§with_cte: Option<With>

WITH clause (CTEs) - for CREATE TABLE … AS WITH … SELECT …

§properties: Vec<Expression>

Table properties like DEFAULT COLLATE (BigQuery)

§partition_of: Option<Expression>

PostgreSQL PARTITION OF property (e.g., CREATE TABLE t PARTITION OF parent …)

§post_table_properties: Vec<Expression>

TSQL: WITH(SYSTEM_VERSIONING=ON(…)) after column definitions

§mysql_table_options: Vec<(String, String)>

MySQL table options after column definitions (ENGINE=val, AUTO_INCREMENT=val, etc.)

§inherits: Vec<TableRef>

PostgreSQL INHERITS clause: INHERITS (parent1, parent2, …)

§on_property: Option<OnProperty>

TSQL ON filegroup or ON filegroup (partition_column) clause

§copy_grants: bool

Snowflake: COPY GRANTS clause to copy privileges from replaced table

§using_template: Option<Box<Expression>>

Snowflake: USING TEMPLATE expression for schema inference

§rollup: Option<RollupProperty>

StarRocks: ROLLUP (r1(col1, col2), r2(col1))

Implementations§

Source§

impl CreateTable

Source

pub fn new(name: impl Into<String>) -> Self

Trait Implementations§

Source§

impl Clone for CreateTable

Source§

fn clone(&self) -> CreateTable

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CreateTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CreateTable

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for CreateTable

Source§

fn eq(&self, other: &CreateTable) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CreateTable

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CreateTable

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,