Tabnine Logo
com.datastax.driver.core.schemabuilder
Code IndexAdd Tabnine to your IDE (free)

How to use com.datastax.driver.core.schemabuilder

Best Java code snippets using com.datastax.driver.core.schemabuilder (Showing top 20 results out of 315)

origin: Netflix/conductor

private String getCreateKeyspaceStatement() {
  return SchemaBuilder.createKeyspace(config.getCassandraKeyspace())
      .ifNotExists()
      .with()
      .replication(ImmutableMap.of("class", config.getReplicationStrategy(), config.getReplicationFactorKey(), config.getReplicationFactorValue()))
      .durableWrites(true)
      .getQueryString();
}
origin: Netflix/conductor

private String getCreateTaskLookupTableStatement() {
  return SchemaBuilder.createTable(config.getCassandraKeyspace(), TABLE_TASK_LOOKUP)
      .ifNotExists()
      .addPartitionKey(TASK_ID_KEY, DataType.uuid())
      .addColumn(WORKFLOW_ID_KEY, DataType.uuid())
      .getQueryString();
}
origin: Netflix/conductor

private String getCreateWorkflowsTableStatement() {
  return SchemaBuilder.createTable(config.getCassandraKeyspace(), TABLE_WORKFLOWS)
      .ifNotExists()
      .addPartitionKey(WORKFLOW_ID_KEY, DataType.uuid())
      .addPartitionKey(SHARD_ID_KEY, DataType.cint())
      .addClusteringColumn(ENTITY_KEY, DataType.text())
      .addClusteringColumn(TASK_ID_KEY, DataType.text())
      .addColumn(PAYLOAD_KEY, DataType.text())
      .addStaticColumn(TOTAL_TASKS_KEY, DataType.cint())
      .addStaticColumn(TOTAL_PARTITIONS_KEY, DataType.cint())
      .getQueryString();
}
origin: palantir/atlasdb

private CompactionOptions<?> getCompaction(boolean appendHeavyReadLight) {
  return appendHeavyReadLight ? SchemaBuilder.sizedTieredStategy().minThreshold(4).maxThreshold(32)
      : SchemaBuilder.leveledStrategy();
}
origin: com.datastax.cassandra/cassandra-driver-core

 /**
  * Define the new type of the altered column, when that type contains a UDT.
  *
  * @param udtType the UDT type. Use {@link SchemaBuilder#frozen(String)} or {@link
  *     SchemaBuilder#udtLiteral(String)}.
  * @return the final statement.
  */
 public SchemaStatement udtType(UDTType udtType) {
  return SchemaStatement.fromQueryString(
    alter.buildInternal() + " ALTER " + columnName + " TYPE " + udtType.asCQLString());
 }
}
origin: com.datastax.cassandra/cassandra-driver-core

 static UDTType literal(String literal) {
  SchemaStatement.validateNotEmpty(literal, "UDT type literal");
  return new UDTType(literal);
 }
}
origin: palantir/atlasdb

private CompressionOptions getCompression(int blockSize) {
  int chunkLength = blockSize != 0 ? blockSize : AtlasDbConstants.MINIMUM_COMPRESSION_BLOCK_SIZE_KB;
  return SchemaBuilder.lz4().withChunkLengthInKb(chunkLength);
}
origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Add options for this CREATE KEYSPACE statement.
 *
 * @return the options of this CREATE KEYSPACE statement.
 */
public KeyspaceOptions with() {
 return new KeyspaceOptions(buildCommand(), keyspaceName);
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(
  groups = "unit",
  expectedExceptions = IllegalArgumentException.class,
  expectedExceptionsMessageRegExp =
    "The altered column name 'add' is not allowed because it is a reserved keyword")
public void should_fail_if_altered_column_is_a_reserved_keyword() throws Exception {
 alterTable("test").alterColumn("add").type(DataType.ascii()).getQueryString();
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(
  groups = "unit",
  expectedExceptions = IllegalArgumentException.class,
  expectedExceptionsMessageRegExp =
    "The new column name 'add' is not allowed because it is a reserved keyword")
public void should_fail_if_added_column_is_a_reserved_keyword() throws Exception {
 alterTable("test").addColumn("add").type(DataType.ascii()).getQueryString();
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(
  groups = "unit",
  expectedExceptions = IllegalArgumentException.class,
  expectedExceptionsMessageRegExp =
    "The dropped column name 'add' is not allowed because it is a reserved keyword")
public void should_fail_if_drop_column_is_a_reserved_keyword() throws Exception {
 alterTable("test").dropColumn("add").getQueryString();
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(
  groups = "unit",
  expectedExceptions = IllegalArgumentException.class,
  expectedExceptionsMessageRegExp =
    "The new column name 'add' is not allowed because it is a reserved keyword")
public void should_fail_if_new_renamed_column_is_a_reserved_keyword() throws Exception {
 alterTable("test").renameColumn("col").to("add");
}
origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Create options for the LZ4 compression strategy, to use in a CREATE or ALTER TABLE statement.
 *
 * @return the options.
 */
public static TableOptions.CompressionOptions lz4() {
 return new TableOptions.CompressionOptions(TableOptions.CompressionOptions.Algorithm.LZ4);
}
origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Start building a new CREATE TABLE statement.
 *
 * @param keyspaceName the name of the keyspace to be used.
 * @param tableName the name of the table to create.
 * @return an in-construction CREATE TABLE statement.
 */
public static Create createTable(String keyspaceName, String tableName) {
 return new Create(keyspaceName, tableName);
}
origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Start building a new ALTER TABLE statement.
 *
 * @param keyspaceName the name of the keyspace to be used.
 * @param tableName the name of the table to be altered.
 * @return an in-construction ALTER TABLE statement.
 */
public static Alter alterTable(String keyspaceName, String tableName) {
 return new Alter(keyspaceName, tableName);
}
origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Start building a new CREATE INDEX statement.
 *
 * @param indexName the name of the table to create.
 * @return an in-construction CREATE INDEX statement.
 */
public static CreateIndex createIndex(String indexName) {
 return new CreateIndex(indexName);
}
origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Add options for this CREATE TABLE statement.
 *
 * @return the options of this CREATE TABLE statement.
 */
public Options withOptions() {
 return new Options(this);
}
origin: jooby-project/jooby

private static void createTableIfNotExists(final com.datastax.driver.core.Session session,
  final String table, final Logger log) {
 Create createTable = SchemaBuilder.createTable(table)
   .addPartitionKey(ID, DataType.varchar())
   .addColumn(CREATED_AT, DataType.timestamp())
   .addColumn(ACCESSED_AT, DataType.timestamp())
   .addColumn(SAVED_AT, DataType.timestamp())
   .addColumn(ATTRIBUTES, DataType.map(DataType.varchar(), DataType.varchar()))
   .ifNotExists();
 Futures.addCallback(session.executeAsync(createTable), new FutureCallback<ResultSet>() {
  @Override
  public void onSuccess(final ResultSet result) {
   log.debug("Session table successfully created");
  }
  @Override
  public void onFailure(final Throwable x) {
   log.error("Create session table resulted in exception", x);
  }
 });
}
origin: com.datastax.cassandra/cassandra-driver-core

static UDTType frozen(String udtName) {
 SchemaStatement.validateNotEmpty(udtName, "UDT name");
 return new UDTType("frozen<" + udtName + ">");
}
origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Create options for the Deflate compression strategy, to use in a CREATE or ALTER TABLE
 * statement.
 *
 * @return the options.
 */
public static TableOptions.CompressionOptions deflate() {
 return new TableOptions.CompressionOptions(TableOptions.CompressionOptions.Algorithm.DEFLATE);
}
com.datastax.driver.core.schemabuilder

Most used classes

  • Create
    A built CREATE TABLE statement.
  • SchemaBuilder
    Static methods to build a CQL3 DDL statement. The provided builders perform very little validation o
  • Create$Options
    The table options of a CREATE TABLE statement.
  • CreateKeyspace
    A built CREATE KEYSPACE statement.
  • KeyspaceOptions
    The keyspace options used in CREATE KEYSPACE or ALTER KEYSPACE statements.
  • TableOptions$CompressionOptions,
  • DropKeyspace,
  • TableOptions$CompactionOptions$SizeTieredCompactionStrategyOptions,
  • CreateIndex$CreateIndexOn,
  • CreateIndex,
  • CreateType,
  • Alter$AddColumn,
  • Alter$AlterColumn,
  • Alter$Options,
  • Alter$RenameColumn,
  • Alter,
  • AlterKeyspace,
  • SchemaStatement,
  • TableOptions$CompactionOptions$DateTieredCompactionStrategyOptions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now