From bc947d0d60b69410d4ed48175c83ec0166d44f76 Mon Sep 17 00:00:00 2001 From: Stefania Alborghetti Date: Tue, 19 May 2015 11:38:42 +0800 Subject: [PATCH] Fixed DESCRIBE names for small and tiny ints, added column names --- cassandra/cqlengine/columns.py | 16 +++++++++++++++- cassandra/cqltypes.py | 4 ++-- cassandra/protocol.py | 6 +++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/cassandra/cqlengine/columns.py b/cassandra/cqlengine/columns.py index ae177795..48a8806c 100644 --- a/cassandra/cqlengine/columns.py +++ b/cassandra/cqlengine/columns.py @@ -377,9 +377,23 @@ class Integer(Column): return self.validate(value) +class TinyInt(Integer): + """ + Stores an 8-bit signed integer value + """ + db_type = 'tinyint' + + +class SmallInt(Integer): + """ + Stores a 16-bit signed integer value + """ + db_type = 'smallint' + + class BigInt(Integer): """ - Stores a 64-bit signed long value + Stores a 64-bit signed integer value """ db_type = 'bigint' diff --git a/cassandra/cqltypes.py b/cassandra/cqltypes.py index 48cbc198..6e9306c7 100644 --- a/cassandra/cqltypes.py +++ b/cassandra/cqltypes.py @@ -424,7 +424,7 @@ class BooleanType(_CassandraType): def serialize(truth, protocol_version): return int8_pack(truth) -class TinyIntType(_CassandraType): +class ByteType(_CassandraType): typename = 'tinyint' @staticmethod @@ -661,7 +661,7 @@ class SimpleDateType(_CassandraType): return util.Date(days) -class SmallIntType(_CassandraType): +class ShortType(_CassandraType): typename = 'smallint' @staticmethod diff --git a/cassandra/protocol.py b/cassandra/protocol.py index f7c7176f..9aab01d2 100644 --- a/cassandra/protocol.py +++ b/cassandra/protocol.py @@ -36,7 +36,7 @@ from cassandra.cqltypes import (AsciiType, BytesType, BooleanType, LongType, MapType, SetType, TimeUUIDType, UTF8Type, UUIDType, UserType, TupleType, lookup_casstype, SimpleDateType, - TimeType, TinyIntType, SmallIntType) + TimeType, ByteType, ShortType) from cassandra.policies import WriteType log = logging.getLogger(__name__) @@ -623,8 +623,8 @@ class ResultMessage(_MessageType): 0x0010: InetAddressType, 0x0011: SimpleDateType, 0x0012: TimeType, - 0x0013: SmallIntType, - 0x0014: TinyIntType, + 0x0013: ShortType, + 0x0014: ByteType, 0x0020: ListType, 0x0021: MapType, 0x0022: SetType,