I have a tab separatd file with a number of columns.
Columns 5 and 6 are the date as yyyy-mm-dd and hh24:mi:ss
I want to add rows with a composite key that consists of an UTF8Type and the DateType (which are fields 5 and 6).
The column family is :
CREATE COLUMN FAMILY traffic
WITH comparator = 'CompositeType(UTF8Type,UTF8Type)' and key_validation_class='CompositeType(UTF8Type,DateType)'
AND column_metadata = [ {column_name: fac, validation_class: UTF8Type, index_type : 0, index_name : fac_idx }]
How can I insert rows with a composite key : field 0 + the combined fields 5 and 6 of the rows.
Below a small piece of the code:
b=cf.batch(queue_size=10000)
with open (‘xxx.csv’) as csvfile:
spamreader=csv.reader(csvfile,delimiter='\t')
for row in spamreader:
b.insert( ) ß how should the insert be done?
b.send()
And more in general how can I cast a string to DateType?