Created
April 15, 2018 17:27
-
-
Save lankydan/9ac9cbb65ac4d67b6112a5a501b0c69c to your computer and use it in GitHub Desktop.
Datastax driver - setup keyspace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void setupKeyspace(Session session, String keyspace) throws IOException { | |
final Map<String, Object> replication = new HashMap<>(); | |
replication.put("class", "SimpleStrategy"); | |
replication.put("replication_factor", 1); | |
session.execute(createKeyspace(keyspace).ifNotExists().with().replication(replication)); | |
session.execute("USE " + keyspace); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment