pub struct CreateOptions {
pub engine: String,
pub order_by: Vec<String>,
pub primary_keys: Vec<String>,
pub partition_by: Option<String>,
pub sampling: Option<String>,
pub settings: Settings,
pub ttl: Option<String>,
pub schema_conversions: Option<SchemaConversions>,
pub defaults: Option<HashMap<String, String>>,
pub defaults_for_nullable: bool,
}
Expand description
Options for creating a ClickHouse
table, specifying engine, ordering, partitioning, and other
settings.
This struct is used to configure the creation of a ClickHouse
table via
create_table_statement_from_arrow
. It supports common table options like ORDER BY
,
PRIMARY KEY
, PARTITION BY
, SAMPLE BY
, TTL
, and custom settings. It also allows
specifying default values for columns and enabling defaults for nullable columns.
§Examples
use clickhouse_arrow::sql::CreateOptions;
use clickhouse_arrow::Settings;
let options = CreateOptions::new("MergeTree")
.with_order_by(&["id".to_string()])
.with_setting("index_granularity", 4096)
.with_ttl("1 DAY");
Fields§
§engine: String
§order_by: Vec<String>
§primary_keys: Vec<String>
§partition_by: Option<String>
§sampling: Option<String>
§settings: Settings
§ttl: Option<String>
§schema_conversions: Option<SchemaConversions>
§defaults: Option<HashMap<String, String>>
§defaults_for_nullable: bool
Implementations§
Source§impl CreateOptions
impl CreateOptions
Sourcepub fn from_engine(engine: impl Into<ClickHouseEngine>) -> Self
pub fn from_engine(engine: impl Into<ClickHouseEngine>) -> Self
Sourcepub fn with_order_by(self, order_by: &[String]) -> Self
pub fn with_order_by(self, order_by: &[String]) -> Self
Sourcepub fn with_primary_keys(self, keys: &[String]) -> Self
pub fn with_primary_keys(self, keys: &[String]) -> Self
Sourcepub fn with_partition_by(self, partition_by: impl Into<String>) -> Self
pub fn with_partition_by(self, partition_by: impl Into<String>) -> Self
Sourcepub fn with_sample_by(self, sampling: impl Into<String>) -> Self
pub fn with_sample_by(self, sampling: impl Into<String>) -> Self
Sourcepub fn with_settings(self, settings: Settings) -> Self
pub fn with_settings(self, settings: Settings) -> Self
Sourcepub fn with_setting<S>(self, name: impl Into<String>, setting: S) -> Selfwhere
SettingValue: From<S>,
pub fn with_setting<S>(self, name: impl Into<String>, setting: S) -> Selfwhere
SettingValue: From<S>,
Sourcepub fn with_defaults<I>(self, defaults: I) -> Self
pub fn with_defaults<I>(self, defaults: I) -> Self
Sourcepub fn with_defaults_for_nullable(self) -> Self
pub fn with_defaults_for_nullable(self) -> Self
Sourcepub fn with_schema_conversions(self, map: SchemaConversions) -> Self
pub fn with_schema_conversions(self, map: SchemaConversions) -> Self
Provide a map of resolved type conversions.
For example, since arrow does not support enum types, providing a map of column name to
Type::Enum8
with enum values ensures arrow::datatypes::DataType::Dictionary
is
serialized as crate::Type::Enum16
instead of the default crate::Type::LowCardinality
§Returns
Self for method chaining.
Sourcepub fn defaults(&self) -> Option<&HashMap<String, String>>
pub fn defaults(&self) -> Option<&HashMap<String, String>>
Returns the configured default values, if any.
§Returns
An optional reference to the HashMap
of column names to default values.
Sourcepub fn schema_conversions(&self) -> Option<&SchemaConversions>
pub fn schema_conversions(&self) -> Option<&SchemaConversions>
Returns the configured default values, if any.
§Returns
An optional reference to the HashMap
of column names to default values.
Trait Implementations§
Source§impl Clone for CreateOptions
impl Clone for CreateOptions
Source§fn clone(&self) -> CreateOptions
fn clone(&self) -> CreateOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more