Exception: Cassandra::Errors::AlreadyExistsError

Inherits:
ConfigurationError show all
Defined in:
lib/cassandra/errors.rb

Overview

Raised when the query attempted to create a keyspace or a table that was already existing.

Examples:

Creating a table twice

session.execute("USE my_keyspace")
session.execute("CREATE TABLE users (user_id INT PRIMARY KEY)")
begin
  session.execute("CREATE TABLE users (user_id INT PRIMARY KEY)")
rescue Cassandra::Errors::AlreadyExistsError => e
  p ['already exists', e.keyspace, e.table]
end

See Also:

Instance Attribute Summary collapse

Attributes included from ValidationError

#statement

Instance Attribute Details

#keyspaceString (readonly)

Returns keyspace.

Returns:

  • (String)

    keyspace



319
320
321
# File 'lib/cassandra/errors.rb', line 319

def keyspace
  @keyspace
end

#tableString? (readonly)

Returns table or nil.

Returns:

  • (String, nil)

    table or nil



322
323
324
# File 'lib/cassandra/errors.rb', line 322

def table
  @table
end