Cassandra 3 -导入和导出Blob失败,出现“str”对象没有属性“decode”“错误

von4xj4u  于 2023-03-08  发布在  Cassandra
关注(0)|答案(1)|浏览(184)

我正在尝试测试将一个表复制到csv文件中,然后将csv文件中的数据导入到表中。

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

"复制到"工作完美。
但"COPY from"失败,并显示以下错误:

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 keyspace_n.collection_n(id1, id2, id3, appname, coll) to /tmp/test.csv WITH HEADER = TRUE;
"复制自"命令:copy keyspace_n.collection_n(id1, id2, id3, appname, coll) from '/tmp/test.csv' WITH HEADER=TRUE;
我将主键更改为唯一。CSV示例:

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

其他信息:

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

Python:

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$

先谢了!
是否有办法成功地将数据从带有blob的CSV导入keyspace_n. collection_n?

92vpleto

92vpleto1#

也许可以简单地利用DSBulk来实现这一点。因为在大表上CQL COPY FROM/TO无论如何都不会非常方便。请参见this answer

相关问题