Skip to content

Instantly share code, notes, and snippets.

@mpenick
Created February 8, 2017 20:41
Show Gist options
  • Select an option

  • Save mpenick/c83beaf3241d83fff60fc7d86d87d4cf to your computer and use it in GitHub Desktop.

Select an option

Save mpenick/c83beaf3241d83fff60fc7d86d87d4cf to your computer and use it in GitHub Desktop.
<?php
$cluster = Cassandra::cluster()
->build();
$session = $cluster->connect();
$session->execute("CREATE KEYSPACE IF NOT EXISTS test WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '3' }");
$session->execute(new Cassandra\SimpleStatement("CREATE TABLE IF NOT EXISTS test.test (key int PRIMARY KEY, value 'LexicalUUIDType')"));
$session->close();
$schema = $session->schema();
$table = $schema->keyspace("test")->table("test");
foreach ($table->columns() as $column) {
$type = $column->type();
echo $type . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment