class Cassandra::Errors::AlreadyExistsError

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

@example 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 github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L728-L737 Description

of Already Exists Error in Apache Cassandra native protocol spec v1

Attributes

keyspace[R]

@return [String] keyspace

table[R]

@return [String, nil] table or `nil`

Public Class Methods

new(message, payload, warnings, r_keyspace, statement, options, hosts, consistency, retries, keyspace, table) click to toggle source

@private

Calls superclass method Cassandra::Errors::ValidationError::new
    # File lib/cassandra/errors.rb
723 def initialize(message,
724                payload,
725                warnings,
726                r_keyspace,
727                statement,
728                options,
729                hosts,
730                consistency,
731                retries,
732                keyspace,
733                table)
734   super(message,
735         payload,
736         warnings,
737         r_keyspace,
738         statement,
739         options,
740         hosts,
741         consistency,
742         retries)
743   @keyspace = keyspace
744   @table    = table
745 end