Class: Cequel::Schema::TableReader
- Inherits:
-
Object
- Object
- Cequel::Schema::TableReader
- Defined in:
- lib/cequel/schema/table_reader.rb
Overview
A TableReader will query Cassandra’s internal representation of a table’s schema, and build a Table instance exposing an object representation of that schema
Constant Summary collapse
- COMPOSITE_TYPE_PATTERN =
/^org\.apache\.cassandra\.db\.marshal\.CompositeType\((.+)\)$/
- REVERSED_TYPE_PATTERN =
/^org\.apache\.cassandra\.db\.marshal\.ReversedType\((.+)\)$/
- COLLECTION_TYPE_PATTERN =
/^org\.apache\.cassandra\.db\.marshal\.(List|Set|Map)Type\((.+)\)$/
Class Method Summary collapse
-
.read(keyspace, table_name) ⇒ Table
Read the schema defined in the database for a given table and return a Table instance.
Instance Method Summary collapse
-
#initialize(keyspace, table_name) ⇒ TableReader
constructor
A new instance of TableReader.
-
#read ⇒ Table
private
Read table schema from the database.
Constructor Details
#initialize(keyspace, table_name) ⇒ TableReader
Returns a new instance of TableReader.
37 38 39 40 |
# File 'lib/cequel/schema/table_reader.rb', line 37 def initialize(keyspace, table_name) @keyspace, @table_name = keyspace, table_name @table = Table.new(table_name.to_sym) end |
Class Method Details
.read(keyspace, table_name) ⇒ Table
Read the schema defined in the database for a given table and return a Cequel::Schema::Table instance
28 29 30 |
# File 'lib/cequel/schema/table_reader.rb', line 28 def self.read(keyspace, table_name) new(keyspace, table_name).read end |
Instance Method Details
#read ⇒ Table
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Read table schema from the database
51 52 53 54 55 56 57 58 59 |
# File 'lib/cequel/schema/table_reader.rb', line 51 def read if table_data.present? read_partition_keys read_clustering_columns read_data_columns read_properties table end end |