我想導入CSV文件卡桑德拉所以,首先我創建密鑰空間和ColumnFamily中這樣如何導入CSV文件卡桑德拉
CREATE COLUMNFAMILY Consumer_complaints(
Date_received varchar,
Product varchar,
Sub_product varchar,
Issue varchar,
Sub_issue varchar,
Consumer_complaint_narrative varchar,
Company_public_response varchar,
Company varchar,
State varchar,
ZIP_code varint,
Tags varchar,
Consumer_consent_provided varchar,
Submitted_via varchar,
Date_sent_to_company varchar,
Company_response_to_consumer varchar,
Timely_response varchar,
Consumer_disputed varchar,
Complaint_ID varint,
PRIMARY KEY(Complaint_ID)
);
我從www.data.gov稱爲消費者投訴csv文件 然後我在命令行鍵入
COPY consumer_complaints (Date_received,Product,Sub_product, Issue, Sub_issue, Consumer_complaint_narrative, Company_public_response, Company, State, ZIP_code, Tags, Consumer_consent_provided, Submitted_via, Date_sent_to_company, Company_response_to_consumer, Timely_response, Consumer_disputed, Complaint_ID) FROM 'consumer_complaints.csv';
採樣輸入
3/21/2017,Credit reporting,,Incorrect information on credit report,Information is not mine,,Company has responded to the consumer and the CFPB and chooses not to provide a public response,EXPERIAN DELAWARE GP,TX,77075,Older American,N/A,Phone,03/21/2017,Closed with non-monetary relief,Yes,No,2397100
04/19/2017,Debt collection,"Other (i.e. phone, health club, etc.)",Disclosure verification of debt,Not disclosed as an attempt to collect,,,"Security Credit Services, LLC",IL,60643,,,Web,04/20/2017,Closed with explanation,Yes,No,2441777
錯誤
Failed to import 1 rows: ParseError - Failed to parse 797XX : invalid lit for int() with base 10: '797XX', given up without retries
Failed to import 1 rows: ParseError - Failed to parse 354XX : invalid lit for int() with base 10: '354XX', given up without retries
Failed to import 2 rows: ParseError - Failed to parse 313XX : invalid lit for int() with base 10: '313XX', given up without retries
Failed to import 2 rows: ParseError - Failed to parse 054XX : invalid lit for int() with base 10: '054XX', given up without retries
我該如何解決?
顯示示例csv文件 –
嗨@ImJa您正在使用cassandra版本的cqlsh?我已經使用cassandra 2.2.4的cqlsh並且它正常工作 –
我檢查數據,一些郵政編碼具有非整數值,如'797XX','354XX','313XX'和'054XX'。你可以看到它顯然不是整數。您可以將這些值更改爲整數或更改您的表並將ZIP_code的類型更改爲'varchar' –