2

i want to copy data from standardevents to standardeventstemp.. below steps i am doing

COPY events.standardevents (uuid, data, name, time, tracker, type, userid) TO 'temp.csv'; 

truncate standardevents;

COPY event.standardeventstemp (uuid, data, name, time, tracker, type, userid) FROM 'temp.csv';

but i am getting below error after 3rd step

Bad Request: Invalid STRING constant (3a1ccec0-ef77-11e3-9e56-22000ae3163a) for name of type uuid

aborting import at column #0, previously inserted values are still present.

can anybody explain the cause of this error and how can i resolve this

datatype of uuid is uuid the rest of the datatypes are varchar

CREATE TABLE standardevents (
  uuid uuid PRIMARY KEY,
  data text,
  name text,
  time text,
  tracker text,
  type text,
  userid text
) WITH
  bloom_filter_fp_chance=0.010000 AND
  caching='KEYS_ONLY' AND
  comment='' AND
  dclocal_read_repair_chance=0.000000 AND
  gc_grace_seconds=864000 AND
  read_repair_chance=0.100000 AND
  replicate_on_write='true' AND
  populate_io_cache_on_flush='false' AND
  compaction={'class': 'SizeTieredCompactionStrategy'} AND
  compression={'sstable_compression': 'SnappyCompressor'};
Helping Hand..
  • 2,430
  • 4
  • 32
  • 52
  • Is the structure of standardeventstemp the same as the structure of standardevents (same field types)? Can you post the first line of your temp.csv? – medvekoma Jun 27 '14 at 09:37
  • yes the structure is same. below is the first line of csv cdb94410-fb16-11e3-8fb1-22000ae3163a,"{\"courseID\":\"447\",\"activityID\":\"16951\",\"activityDesc\":\"Perceptual Constancy\",\"timeSpent\":\"228242\",\"startTime\":\"1403555882325\",\"endTime\":\"1403556110567\",\"status\":\"PASS\",\"LTIData\":{\"LTIUserID\":\"110446\", \"LTICourseID\":\"11551\"}}",ActivityPg_viewComplete,1403556111065,20DA710734020D7B3A1E8AFE9DD1B9D1,user,62419 – Helping Hand.. Jun 27 '14 at 09:43
  • I recreated your tables, and can import a test line and even your quoted line without a problem. I however get the same error, if I put the uuid value in quotes in the csv file. Can you verify that none of your uuid values are in quotes in your csv file? – medvekoma Jun 27 '14 at 09:50
  • i checked by putting the values in double quotes but didn't worked.. – Helping Hand.. Jun 27 '14 at 10:12
  • tell me how you did so it worked for you.. – Helping Hand.. Jun 27 '14 at 10:20
  • I created the two tables with the create table script you quoted. I switched to the keyspace (use keyspace), then executed the command: `COPY standardeventstemp (uuid, data, name, time, tracker, type, userid) FROM 'temp.csv';` My test temp.csv is [here](http://medvekoma.net/files/temp.csv) – medvekoma Jun 27 '14 at 11:51
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/56417/discussion-between-medvekoma-and-working-hard). – medvekoma Jun 27 '14 at 12:03
  • 1
    How do you do this to not a csv? The table I have is terabytes. – Justin Thomas Nov 25 '15 at 01:03

1 Answers1

4

It turned out that this is a known bug in Cassandra 1.2.2.

The same commands work fine in 2.0.x, so an upgrade will fix the problem.

Community
  • 1
  • 1
medvekoma
  • 1,179
  • 7
  • 11
  • FWIW - This is reported as fixed in version 1.2.3. This might be useful to know, if (like me) you are constrained from jumping to 2.0.x (I'm limited to 1.4.0 right now, and the near future only promises as high as 1.6.x for our environment - or so I've been told). – Stevel Sep 21 '16 at 18:48