-1

I'm trying to test copying a table into a csv, and then importing the data int he csv into a table.

Table:
CREATE TABLE keyspace_n.collection_n (
id1 text,
id2 int,
id3 text,
appname text,
coll blob,
PRIMARY KEY ((id1, id2), id).....

"COPY to" works perfectly.

But "COPY from" fails with the following error:

Failed to import 1 rows: ParseError - Failed to parse 0x000000017b........7d : 'str' object has no attribute 'decode', given up without retries
Failed to import 1 rows: ParseError - Invalid row length 0 should be 5, given up without retries
Failed to process 2 rows; failed rows written to err_file

"Copy to" command: copy keyspace_n.collection_n(id1, id2, id3, appname, coll) to /tmp/test.csv WITH HEADER = TRUE;

"Copy from" command: copy keyspace_n.collection_n(id1, id2, id3, appname, coll) from '/tmp/test.csv' WITH HEADER=TRUE;

I changed the PRIMARY KEYs to be unique. CSV sample:

id1,id2,id3,appname,coll
app23,123,fe45bbce8-dfce-4d1f-8129-bec5c7026e17,application1,0x000000017...(I removed the blob)..d7d

Other information:

cqlsh> show version
[cqlsh 5.0.1 | Cassandra 3.11.13-E001 | CQL spec 3.4.4 | Native protocol v4]

Pythons:

bash-4.4$ which python
which: no python in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)
bash-4.4$ which python3
/usr/bin/python3
bash-4.4$ python3 --version
Python 3.6.15
bash-4.4$

Thanks in advance!

Is there a way to successfully import the data from the CSV with the blob into keyspace_n.collection_n?

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Сергей Кох Mar 02 '23 at 07:17
  • Hi - sure thing. Is there a way to work around this issue in order to import the data into Cassandra? The process I did was - 1) Export into CSV which was successful. 2) Change the keys so that it's unique in the CSV. 3) Import it back into the table. The import fails with the errors above. Is there a way to solve this? Thanks! – Maury Platovich Mar 02 '23 at 17:54

1 Answers1

0

Maybe simply leverage DSBulk for achieving this. As CQL COPY FROM/TO on large table anyways is not going to be super convenient. See this answer

Madhavan
  • 758
  • 4
  • 8