Skip to main content

AlterTableAction

Enum AlterTableAction 

Source
pub enum AlterTableAction {
Show 31 variants AddColumn { column: ColumnDef, if_not_exists: bool, position: Option<ColumnPosition>, }, DropColumn { name: Identifier, if_exists: bool, cascade: bool, }, RenameColumn { old_name: Identifier, new_name: Identifier, if_exists: bool, }, AlterColumn { name: Identifier, action: AlterColumnAction, use_modify_keyword: bool, }, RenameTable(TableRef), AddConstraint(TableConstraint), DropConstraint { name: Identifier, if_exists: bool, }, DropForeignKey { name: Identifier, }, DropPartition { partitions: Vec<Vec<(Identifier, Expression)>>, if_exists: bool, }, AddPartition { partition: Expression, if_not_exists: bool, location: Option<Expression>, }, Delete { where_clause: Expression, }, SwapWith(TableRef), SetProperty { properties: Vec<(String, Expression)>, }, UnsetProperty { properties: Vec<String>, }, ClusterBy { expressions: Vec<Expression>, }, SetTag { expressions: Vec<(String, Expression)>, }, UnsetTag { names: Vec<String>, }, SetOptions { expressions: Vec<Expression>, }, AlterIndex { name: Identifier, visible: bool, }, SetAttribute { attribute: String, }, SetStageFileFormat { options: Option<Expression>, }, SetStageCopyOptions { options: Option<Expression>, }, AddColumns { columns: Vec<ColumnDef>, cascade: bool, }, DropColumns { names: Vec<Identifier>, }, ChangeColumn { old_name: Identifier, new_name: Identifier, data_type: Option<DataType>, comment: Option<String>, cascade: bool, }, AlterSortKey { this: Option<String>, expressions: Vec<Expression>, compound: bool, }, AlterDistStyle { style: String, distkey: Option<Identifier>, }, SetTableProperties { properties: Vec<(Expression, Expression)>, }, SetLocation { location: String, }, SetFileFormat { format: String, }, ReplacePartition { partition: Expression, source: Option<Box<Expression>>, },
}
Expand description

Actions for ALTER TABLE

Variants§

§

AddColumn

Fields

§column: ColumnDef
§if_not_exists: bool
§

DropColumn

Fields

§if_exists: bool
§cascade: bool
§

RenameColumn

Fields

§old_name: Identifier
§new_name: Identifier
§if_exists: bool
§

AlterColumn

Fields

§use_modify_keyword: bool

Whether this was parsed from MODIFY COLUMN syntax (MySQL)

§

RenameTable(TableRef)

§

AddConstraint(TableConstraint)

§

DropConstraint

Fields

§if_exists: bool
§

DropForeignKey

DROP FOREIGN KEY action (Oracle/MySQL): ALTER TABLE t DROP FOREIGN KEY fk_name

Fields

§

DropPartition

DROP PARTITION action (Hive/BigQuery)

Fields

§partitions: Vec<Vec<(Identifier, Expression)>>

List of partitions to drop (each partition is a list of key=value pairs)

§if_exists: bool
§

AddPartition

ADD PARTITION action (Hive/Spark)

Fields

§partition: Expression

The partition expression

§if_not_exists: bool
§location: Option<Expression>
§

Delete

DELETE action (BigQuery): ALTER TABLE t DELETE WHERE condition

Fields

§where_clause: Expression
§

SwapWith(TableRef)

SWAP WITH action (Snowflake): ALTER TABLE a SWAP WITH b

§

SetProperty

SET property action (Snowflake): ALTER TABLE t SET property=value

Fields

§properties: Vec<(String, Expression)>
§

UnsetProperty

UNSET property action (Snowflake): ALTER TABLE t UNSET property

Fields

§properties: Vec<String>
§

ClusterBy

CLUSTER BY action (Snowflake): ALTER TABLE t CLUSTER BY (col1, col2)

Fields

§expressions: Vec<Expression>
§

SetTag

SET TAG action (Snowflake): ALTER TABLE t SET TAG key=‘value’

Fields

§expressions: Vec<(String, Expression)>
§

UnsetTag

UNSET TAG action (Snowflake): ALTER TABLE t UNSET TAG key1, key2

Fields

§names: Vec<String>
§

SetOptions

SET with parenthesized options (TSQL): ALTER TABLE t SET (SYSTEM_VERSIONING=ON, …)

Fields

§expressions: Vec<Expression>
§

AlterIndex

ALTER INDEX action (MySQL): ALTER TABLE t ALTER INDEX i VISIBLE/INVISIBLE

Fields

§visible: bool
§

SetAttribute

PostgreSQL: ALTER TABLE t SET LOGGED/UNLOGGED/WITHOUT CLUSTER/WITHOUT OIDS/ACCESS METHOD/TABLESPACE

Fields

§attribute: String
§

SetStageFileFormat

Snowflake: ALTER TABLE t SET STAGE_FILE_FORMAT = (options)

Fields

§

SetStageCopyOptions

Snowflake: ALTER TABLE t SET STAGE_COPY_OPTIONS = (options)

Fields

§

AddColumns

Hive/Spark: ADD COLUMNS (col1 TYPE, col2 TYPE) [CASCADE]

Fields

§columns: Vec<ColumnDef>
§cascade: bool
§

DropColumns

Spark/Databricks: DROP COLUMNS (col1, col2, …)

Fields

§

ChangeColumn

Hive/MySQL/SingleStore: CHANGE [COLUMN] old_name new_name [data_type] [COMMENT ‘comment’] In SingleStore, data_type can be omitted for simple column renames

Fields

§old_name: Identifier
§new_name: Identifier
§data_type: Option<DataType>
§comment: Option<String>
§cascade: bool
§

AlterSortKey

Redshift: ALTER TABLE t ALTER SORTKEY AUTO|NONE|(col1, col2) Also: ALTER TABLE t ALTER COMPOUND SORTKEY (col1, col2)

Fields

§this: Option<String>

AUTO or NONE keyword

§expressions: Vec<Expression>

Column list for (col1, col2) syntax

§compound: bool

Whether COMPOUND keyword was present

§

AlterDistStyle

Redshift: ALTER TABLE t ALTER DISTSTYLE ALL|EVEN|AUTO|KEY Also: ALTER TABLE t ALTER DISTSTYLE KEY DISTKEY col Also: ALTER TABLE t ALTER DISTKEY col (shorthand for DISTSTYLE KEY DISTKEY col)

Fields

§style: String

Distribution style: ALL, EVEN, AUTO, or KEY

§distkey: Option<Identifier>

DISTKEY column (only when style is KEY)

§

SetTableProperties

Redshift: ALTER TABLE t SET TABLE PROPERTIES (‘a’ = ‘5’, ‘b’ = ‘c’)

Fields

§properties: Vec<(Expression, Expression)>
§

SetLocation

Redshift: ALTER TABLE t SET LOCATION ‘s3://bucket/folder/’

Fields

§location: String
§

SetFileFormat

Redshift: ALTER TABLE t SET FILE FORMAT AVRO

Fields

§format: String
§

ReplacePartition

ClickHouse: ALTER TABLE t REPLACE PARTITION expr FROM source_table

Fields

§partition: Expression

Trait Implementations§

Source§

impl Clone for AlterTableAction

Source§

fn clone(&self) -> AlterTableAction

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 AlterTableAction

Source§

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

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

impl<'de> Deserialize<'de> for AlterTableAction

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 AlterTableAction

Source§

fn eq(&self, other: &AlterTableAction) -> 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 AlterTableAction

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 AlterTableAction

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>,