Class TableDefinition
java.lang.Object
com.datastax.astra.client.tables.definition.TableDefinition
Definition of a table.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddColumn
(String columnName, ColumnDefinition columnDefinition) Adds a column to the table definition.addColumn
(String name, ColumnTypes type) Adds a column to the table with a specific type.addColumnAscii
(String name) Adds an ascii column to the table.addColumnBigInt
(String name) Adds a boolean column to the table.addColumnBlob
(String name) Adds a blob column to the table.addColumnBoolean
(String name) Adds a boolean column to the table.addColumnInt
(String name) Adds an integer column to the table.addColumnList
(String name, ColumnTypes valueType) Adds a list column to the table.addColumnMap
(String name, ColumnTypes keyType, ColumnTypes valueType) Adds a map column to the table.addColumnSet
(String name, ColumnTypes valueType) Adds a set column to the table.addColumnText
(String name) Adds a text column to the table.addColumnTimestamp
(String name) Adds a timestamp column to the table.addColumnVector
(String name, ColumnDefinitionVector colDefVector) Adds a vector column to the table.addPartitionBy
(String partitionKey) Adds a partition key to the table's primary key.addPartitionSort
(Sort column) Adds a sort column to the table's primary key.clusteringColumns
(Sort... clusteringColumns) Sets the clustering columns for the table.partitionKey
(String... partitionKeys) Sets the partition keys for the table.toString()
-
Constructor Details
-
TableDefinition
public TableDefinition()Default constructor.
-
-
Method Details
-
addColumn
Adds a column to the table definition.- Parameters:
columnName
- the name of the columncolumnDefinition
- the definition of the column- Returns:
- the updated
TableDefinition
instance - Throws:
IllegalArgumentException
- ifcolumnName
is null
-
addColumn
Adds a column to the table with a specific type.- Parameters:
name
- the name of the columntype
- the type of the column- Returns:
- the updated
TableDefinition
instance
-
addColumnText
Adds a text column to the table.- Parameters:
name
- the name of the column- Returns:
- the updated
TableDefinition
instance
-
addColumnAscii
Adds an ascii column to the table.- Parameters:
name
- the name of the column- Returns:
- the updated
TableDefinition
instance
-
addColumnInt
Adds an integer column to the table.- Parameters:
name
- the name of the column- Returns:
- the updated
TableDefinition
instance
-
addColumnTimestamp
Adds a timestamp column to the table.- Parameters:
name
- the name of the column- Returns:
- the updated
TableDefinition
instance
-
addColumnBoolean
Adds a boolean column to the table.- Parameters:
name
- the name of the column- Returns:
- the updated
TableDefinition
instance
-
addColumnBigInt
Adds a boolean column to the table.- Parameters:
name
- the name of the column- Returns:
- the updated
TableDefinition
instance
-
addColumnBlob
Adds a blob column to the table.- Parameters:
name
- the name of the column- Returns:
- the updated
TableDefinition
instance
-
addColumnList
Adds a list column to the table.- Parameters:
name
- the name of the columnvalueType
- the type of the elements in the list- Returns:
- the updated
TableDefinition
instance
-
addColumnSet
Adds a set column to the table.- Parameters:
name
- the name of the columnvalueType
- the type of the elements in the set- Returns:
- the updated
TableDefinition
instance
-
addColumnMap
Adds a map column to the table.- Parameters:
name
- the name of the columnkeyType
- the type of the keys in the mapvalueType
- the type of the values in the map- Returns:
- the updated
TableDefinition
instance
-
addColumnVector
Adds a vector column to the table.- Parameters:
name
- the name of the columncolDefVector
- the definition of the vector column- Returns:
- the updated
TableDefinition
instance
-
addPartitionBy
Adds a partition key to the table's primary key.- Parameters:
partitionKey
- the name of the partition key column- Returns:
- the updated
TableDefinition
instance
-
addPartitionSort
Adds a sort column to the table's primary key.- Parameters:
column
- the sort column to add- Returns:
- the updated
TableDefinition
instance - Throws:
IllegalArgumentException
- ifcolumn
is null or invalid
-
partitionKey
Sets the partition keys for the table.- Parameters:
partitionKeys
- the partition keys- Returns:
- the updated
TableDefinition
instance - Throws:
IllegalArgumentException
- if any of the partition keys are not valid columns
-
clusteringColumns
Sets the clustering columns for the table.- Parameters:
clusteringColumns
- the clustering columns- Returns:
- the updated
TableDefinition
instance - Throws:
IllegalArgumentException
- if any of the clustering columns are not valid columns
-
toString
-