@@ -92,6 +92,57 @@ class Column(object):
9292
9393 instance_counter = 0
9494
95+ primary_key = False
96+ """
97+ bool flag, indicates this column is a primary key. The first primary key defined
98+ on a model is the partition key (unless partition keys are set), all others are cluster keys
99+ """
100+
101+ partition_key = False
102+
103+ """
104+ indicates that this column should be the partition key, defining
105+ more than one partition key column creates a compound partition key
106+ """
107+
108+ index = False
109+ """
110+ bool flag, indicates an index should be created for this column
111+ """
112+
113+ db_field = False
114+ """
115+ the fieldname this field will map to in the database
116+ """
117+
118+ default = False
119+ """
120+ the default value, can be a value or a callable (no args)
121+ """
122+
123+ required = False
124+ """
125+ boolean, is the field required? Model validation will raise and
126+ exception if required is set to True and there is a None value assigned
127+ """
128+
129+ clustering_order = False
130+ """
131+ only applicable on clustering keys (primary keys that are not partition keys)
132+ determines the order that the clustering keys are sorted on disk
133+ """
134+
135+ polymorphic_key = False
136+ """
137+ boolean, if set to True, this column will be used for saving and loading instances
138+ of polymorphic tables
139+ """
140+
141+ static = False
142+ """
143+ boolean, if set to True, this is a static column, with a single value per partition
144+ """
145+
95146 def __init__ (self ,
96147 primary_key = False ,
97148 partition_key = False ,
@@ -102,21 +153,6 @@ def __init__(self,
102153 clustering_order = None ,
103154 polymorphic_key = False ,
104155 static = False ):
105- """
106- :param primary_key: bool flag, indicates this column is a primary key. The first primary key defined
107- on a model is the partition key (unless partition keys are set), all others are cluster keys
108- :param partition_key: indicates that this column should be the partition key, defining
109- more than one partition key column creates a compound partition key
110- :param index: bool flag, indicates an index should be created for this column
111- :param db_field: the fieldname this field will map to in the database
112- :param default: the default value, can be a value or a callable (no args)
113- :param required: boolean, is the field required? Model validation will raise and
114- exception if required is set to True and there is a None value assigned
115- :param clustering_order: only applicable on clustering keys (primary keys that are not partition keys)
116- determines the order that the clustering keys are sorted on disk
117- :param polymorphic_key: boolean, if set to True, this column will be used for saving and loading instances
118- of polymorphic tables
119- """
120156 self .partition_key = partition_key
121157 self .primary_key = partition_key or primary_key
122158 self .index = index
@@ -216,6 +252,9 @@ def _val_is_null(self, val):
216252
217253
218254class Blob (Column ):
255+ """
256+ Stores a raw binary value
257+ """
219258 db_type = 'blob'
220259
221260 def to_database (self , value ):
@@ -233,15 +272,36 @@ def to_python(self, value):
233272Bytes = Blob
234273
235274class Ascii (Column ):
275+ """
276+ Stores a US-ASCII character string
277+ """
236278 db_type = 'ascii'
237279
238280class Inet (Column ):
281+ """
282+ Stores an IP address in IPv4 or IPv6 format
283+ """
239284 db_type = 'inet'
240285
241286
242287class Text (Column ):
288+ """
289+ Stores a UTF-8 encoded string
290+ """
291+
243292 db_type = 'text'
244293
294+ min_length = None
295+ """
296+ Sets the minimum length of this string, for validation purposes.
297+ Defaults to 1 if this is a ``required`` column. Otherwise, None.
298+ """
299+
300+ max_length = None
301+ """
302+ Sets the maximum length of this string, for validation purposes.
303+ """
304+
245305 def __init__ (self , * args , ** kwargs ):
246306 self .min_length = kwargs .pop ('min_length' , 1 if kwargs .get ('required' , False ) else None )
247307 self .max_length = kwargs .pop ('max_length' , None )
@@ -262,6 +322,10 @@ def validate(self, value):
262322
263323
264324class Integer (Column ):
325+ """
326+ Stores a 32-bit signed integer value
327+ """
328+
265329 db_type = 'int'
266330
267331 def validate (self , value ):
@@ -280,10 +344,16 @@ def to_database(self, value):
280344
281345
282346class BigInt (Integer ):
347+ """
348+ Stores a 64-bit signed long value
349+ """
283350 db_type = 'bigint'
284351
285352
286353class VarInt (Column ):
354+ """
355+ Stores an arbitrary-precision integer
356+ """
287357 db_type = 'varint'
288358
289359 def validate (self , value ):
@@ -311,6 +381,9 @@ def __init__(self, instance, column, value):
311381
312382
313383class Counter (Integer ):
384+ """
385+ Stores a counter that can be inremented and decremented
386+ """
314387 db_type = 'counter'
315388
316389 value_manager = CounterValueManager
@@ -330,6 +403,9 @@ def __init__(self,
330403
331404
332405class DateTime (Column ):
406+ """
407+ Stores a datetime value
408+ """
333409 db_type = 'timestamp'
334410
335411 def to_python (self , value ):
@@ -358,6 +434,12 @@ def to_database(self, value):
358434
359435
360436class Date (Column ):
437+ """
438+ *Note: this type is overloaded, and will likely be changed or removed to accommodate distinct date type
439+ in a future version*
440+
441+ Stores a date value, with no time-of-day
442+ """
361443 db_type = 'timestamp'
362444
363445 def to_python (self , value ):
@@ -384,7 +466,7 @@ def to_database(self, value):
384466
385467class UUID (Column ):
386468 """
387- Type 1 or 4 UUID
469+ Stores a type 1 or 4 UUID
388470 """
389471 db_type = 'uuid'
390472
@@ -451,6 +533,9 @@ def from_datetime(self, dt):
451533
452534
453535class Boolean (Column ):
536+ """
537+ Stores a boolean True or False value
538+ """
454539 db_type = 'boolean'
455540
456541 def validate (self , value ):
@@ -467,6 +552,9 @@ def to_python(self, value):
467552
468553
469554class Float (Column ):
555+ """
556+ Stores a 32-bit floating point value
557+ """
470558 db_type = 'double'
471559
472560 def __init__ (self , double_precision = True , ** kwargs ):
@@ -489,6 +577,9 @@ def to_database(self, value):
489577
490578
491579class Decimal (Column ):
580+ """
581+ Stores a variable precision decimal value
582+ """
492583 db_type = 'decimal'
493584
494585 def validate (self , value ):
0 commit comments