public final class SchemaBuilder extends Object
The provided builders perform very little validation of the built query. There is thus no guarantee that a built query is valid, and it is definitively possible to create invalid queries.
Note that it could be convenient to use an 'import static' to use the methods of this class.
Modifier and Type | Class and Description |
---|---|
static class |
SchemaBuilder.Caching
Caching strategies, for use in a CREATE or ALTER TABLE statement.
|
static class |
SchemaBuilder.Direction
The direction used in clustering order declarations.
|
static class |
SchemaBuilder.KeyCaching
Key caching strategies for Cassandra 2.1, for use in a CREATE or ALTER TABLE statement.
|
Modifier and Type | Method and Description |
---|---|
static TableOptions.AdditionalWritePolicyValue |
additionalWritePolicyAlways() |
static TableOptions.AdditionalWritePolicyValue |
additionalWritePolicyMillisecs(int millisecs) |
static TableOptions.AdditionalWritePolicyValue |
additionalWritePolicyNever() |
static TableOptions.AdditionalWritePolicyValue |
additionalWritePolicyPercentile(int percentile) |
static TableOptions.CachingRowsPerPartition |
allRows()
Return the row caching strategy that caches all rows (
all ), to use in a CREATE or ALTER
TABLE statement. |
static AlterKeyspace |
alterKeyspace(String keyspaceName)
Start building a new ALTER KEYSPACE statement.
|
static Alter |
alterTable(String tableName)
Start building a new ALTER TABLE statement.
|
static Alter |
alterTable(String keyspaceName,
String tableName)
Start building a new ALTER TABLE statement.
|
static TableOptions.SpeculativeRetryValue |
always()
Create the speculative retry strategy that retries reads of all replicas, to use in a CREATE or
ALTER TABLE statement.
|
static CreateIndex |
createIndex(String indexName)
Start building a new CREATE INDEX statement.
|
static CreateKeyspace |
createKeyspace(String keyspaceName)
Start building a new CREATE KEYSPACE statement.
|
static Create |
createTable(String tableName)
Start building a new CREATE TABLE statement.
|
static Create |
createTable(String keyspaceName,
String tableName)
Start building a new CREATE TABLE statement.
|
static CreateType |
createType(String typeName)
Start building a new CREATE TYPE statement.
|
static CreateType |
createType(String keyspaceName,
String typeName)
Start building a new CREATE TYPE statement.
|
static TableOptions.CompactionOptions.DateTieredCompactionStrategyOptions |
dateTieredStrategy()
Create options for the date-tiered compaction strategy, to use in a CREATE or ALTER TABLE
statement.
|
static TableOptions.CompressionOptions |
deflate()
Create options for the Deflate compression strategy, to use in a CREATE or ALTER TABLE
statement.
|
static Drop |
dropIndex(String indexName)
Start building a new DROP INDEX statement.
|
static Drop |
dropIndex(String keyspaceName,
String indexName)
Start building a new DROP INDEX statement.
|
static DropKeyspace |
dropKeyspace(String keyspaceName)
Start building a new DROP KEYSPACE statement.
|
static Drop |
dropTable(String tableName)
Start building a new DROP TABLE statement.
|
static Drop |
dropTable(String keyspaceName,
String tableName)
Start building a new DROP TABLE statement.
|
static Drop |
dropType(String typeName)
Start building a new DROP TYPE statement.
|
static Drop |
dropType(String keyspaceName,
String typeName)
Start building a new DROP TYPE statement.
|
static UDTType |
frozen(String udtName)
Build the datatype representation of a frozen UDT, to include in a schema builder statement.
|
static TableOptions.CompactionOptions.LeveledCompactionStrategyOptions |
leveledStrategy()
Create options for the leveled compaction strategy, to use in a CREATE or ALTER TABLE
statement.
|
static TableOptions.CompressionOptions |
lz4()
Create options for the LZ4 compression strategy, to use in a CREATE or ALTER TABLE statement.
|
static TableOptions.SpeculativeRetryValue |
millisecs(int millisecs)
Create the speculative retry strategy that retries after a given delay, to use in a CREATE or
ALTER TABLE statement.
|
static TableOptions.CompressionOptions |
noCompression()
Create options for the
NONE compression strategy, to use in a CREATE or ALTER TABLE
statement. |
static TableOptions.CachingRowsPerPartition |
noRows()
Return the row caching strategy that never caches rows (
none , to use in a CREATE or
ALTER TABLE statement. |
static TableOptions.SpeculativeRetryValue |
noSpeculativeRetry()
Create the speculative retry strategy that never retries reads, to use in a CREATE or ALTER
TABLE statement.
|
static TableOptions.SpeculativeRetryValue |
percentile(int percentile)
Create the speculative retry strategy that retries based on the effect on throughput and
latency, to use in a CREATE or ALTER TABLE statement.
|
static TableOptions.CachingRowsPerPartition |
rows(int rowNumber)
Return the row caching strategy that caches a given number of rows, to use in a CREATE or ALTER
TABLE statement.
|
static TableOptions.CompactionOptions.SizeTieredCompactionStrategyOptions |
sizedTieredStategy()
Create options for the size-tiered compaction strategy, for use in a CREATE or ALTER TABLE
statement.
|
static TableOptions.CompressionOptions |
snappy()
Create options for the Snappy compression strategy, to use in a CREATE or ALTER TABLE
statement.
|
static TableOptions.CompactionOptions.TimeWindowCompactionStrategyOptions |
timeWindowCompactionStrategy()
Create options for the time window compaction strategy, to use in a CREATE or ALTER TABLE
statement.
|
static UDTType |
udtLiteral(String literal)
Build the datatype representation of a complex UDT type, to include in a schema builder
statement.
|
public static CreateKeyspace createKeyspace(String keyspaceName)
keyspaceName
- the name of the keyspace to create.public static Create createTable(String tableName)
tableName
- the name of the table to create.public static Create createTable(String keyspaceName, String tableName)
keyspaceName
- the name of the keyspace to be used.tableName
- the name of the table to create.public static AlterKeyspace alterKeyspace(String keyspaceName)
keyspaceName
- the name of the keyspace to be altered.public static Alter alterTable(String tableName)
tableName
- the name of the table to be altered.public static Alter alterTable(String keyspaceName, String tableName)
keyspaceName
- the name of the keyspace to be used.tableName
- the name of the table to be altered.public static Drop dropTable(String tableName)
tableName
- the name of the table to be dropped.public static DropKeyspace dropKeyspace(String keyspaceName)
keyspaceName
- the name of the keyspace to be dropped.public static Drop dropTable(String keyspaceName, String tableName)
keyspaceName
- the name of the keyspace to be used.tableName
- the name of the table to be dropped.public static CreateIndex createIndex(String indexName)
indexName
- the name of the table to create.public static Drop dropIndex(String indexName)
indexName
- the name of the index to be dropped.public static Drop dropIndex(String keyspaceName, String indexName)
keyspaceName
- the name of the keyspace to be used.indexName
- the name of the index to be dropped.public static CreateType createType(String typeName)
typeName
- the name of the custom type to create.public static CreateType createType(String keyspaceName, String typeName)
keyspaceName
- the name of the keyspace to be used.typeName
- the name of the custom type to create.public static Drop dropType(String typeName)
typeName
- the name of the type to be dropped.public static Drop dropType(String keyspaceName, String typeName)
keyspaceName
- the name of the keyspace to be used.typeName
- the name of the type to be dropped.public static UDTType frozen(String udtName)
frozen("foo")
will produce frozen<foo>
.
udtName
- the name of the UDT.public static UDTType udtLiteral(String literal)
As of Cassandra 2.1, this method is not strictly necessary because Create
and Alter
provide specialized methods to express simple collections of UDTs, but future versions
will make it possible to use types such as
map<text, map<text, frozen<user>>>
.
literal
- the type literal as it will appear in the final CQL statement.public static TableOptions.CompactionOptions.SizeTieredCompactionStrategyOptions sizedTieredStategy()
public static TableOptions.CompactionOptions.LeveledCompactionStrategyOptions leveledStrategy()
public static TableOptions.CompactionOptions.DateTieredCompactionStrategyOptions dateTieredStrategy()
This strategy was introduced in Cassandra 2.1.1.
public static TableOptions.CompactionOptions.TimeWindowCompactionStrategyOptions timeWindowCompactionStrategy()
This strategy was introduced in Cassandra 3.0.8 and 3.9.
public static TableOptions.CompressionOptions noCompression()
NONE
compression strategy, to use in a CREATE or ALTER TABLE
statement.public static TableOptions.CompressionOptions lz4()
public static TableOptions.CompressionOptions snappy()
public static TableOptions.CompressionOptions deflate()
public static TableOptions.SpeculativeRetryValue noSpeculativeRetry()
public static TableOptions.SpeculativeRetryValue always()
public static TableOptions.SpeculativeRetryValue percentile(int percentile)
public static TableOptions.SpeculativeRetryValue millisecs(int millisecs)
public static TableOptions.CachingRowsPerPartition noRows()
none
, to use in a CREATE or
ALTER TABLE statement.public static TableOptions.CachingRowsPerPartition allRows()
all
), to use in a CREATE or ALTER
TABLE statement.
Be careful when choosing this option, you can starve Cassandra memory quickly if your partition is very large.
public static TableOptions.CachingRowsPerPartition rows(int rowNumber)
rowNumber
- the number of rows to cache.public static TableOptions.AdditionalWritePolicyValue additionalWritePolicyNever()
public static TableOptions.AdditionalWritePolicyValue additionalWritePolicyAlways()
public static TableOptions.AdditionalWritePolicyValue additionalWritePolicyPercentile(int percentile)
public static TableOptions.AdditionalWritePolicyValue additionalWritePolicyMillisecs(int millisecs)
Copyright © 2012–2024. All rights reserved.