尝试将 csv 文件加载到 hbase,但在运行时出现错误:
使用的版本:
快乐基地 0.9
Python 2.6.6
地图数据库
TypeError:对于列表/集合类型参数,期望大小为 3 的元组
下面是使用的代码
import csv
import happybase
# CSV file of customer records -- change me
f = '/mapr/demo.mapr.com/project/cust.csv'
ufile = open(f)
reader = csv.DictReader(ufile)
conn = happybase.Connection('localhost')
table = conn.table('cust_table')
print "reading customer file %s" % f
i = 0
for row in reader:
i += 1
table.put(row['CustID'],
{'cdata:name': row['Name'],
'cdata:gender': row['Gender'],
'cdata:address': row['Address'],
'cdata:zip': row['zip'],
'cdata:signdate': row['SignDate'],
'cdata:status': row['Status'],
'cdata:level': row['Level'],
'cdata:campaign': row['Campaign'],
# 'cdata:linked_with_apps': row['LinkedWithApps']
})
print "loaded cust db with %d entries" % i
任何帮助,将不胜感激。