문제

i am trying to insert data (from .csv file having 5 rows) in cassandra using COPY command.

COPY countries FROM 'test.csv';

when i run it, it shows 5 rows inserted but in actual only the last row get inserted everytime....what is the problem?

it contains data like this:

PAK,"Agricultural machinery, tractors",AG.AGR.TRAC.NO,326595,,,,,,,,,,,,

PAK,Fertilizer consumption (% of fertilizer production),AG.CON.FERT.PT.ZS,,,132.1337386,131.0100419,130.7348415,134.556521,136.7203605,130.6755602,122.0807766,168.724502,142.8166022,,

PAK,Fertilizer consumption (kilograms per hectare of arable land),AG.CON.FERT.ZS,,,140.8423586,145.9477245,157.6759803,175.1937926,177.5152969,169.8114221,171.9300583,242.1624519,217.1438583,,

PAK,Agricultural land (sq. km),AG.LND.AGRI.K2,269500,271600,272700,272300,270300,270600,272900,268800,262700,263800,264000,265500,

PAK,Agricultural land (% of land area),AG.LND.AGRI.ZS,34.96004566,35.2324616,35.37515567,35.32326692,35.06382316,35.10273973,35.40110004,34.86924035,34.0779369,34.22063097,34.24657534,34.44115816,5

도움이 되었습니까?

해결책

I assume your primary key is your first column. All inserts in C* are upserts so you are just rewriting all the previous rows since they all have the same first column.

다른 팁

Your command has to be in this format.

COPY keyspace.columnfamily (column1, column2,...) FROM 'test.csv';

and also specify column-names to.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top