CQLSH client - module' object has no attribute 'parse_options

拟墨画扇 提交于 2020-01-03 08:38:09

问题


I'm trying to access my Cassandra server through a CQLSH client to import a huge CSV file. I'm getting a module' object has no attribute 'parse_options error.

I run the follow command:

cqlsh XXX.XXX.XX.XX XXXX --cqlversion="3.4.2" --execute="copy evolvdso.teste from '2016-10-26 15:25:10.csv' WITH DELIMITER =',' AND HEADER=TRUE --debug";

This is the debug and error message that follows:

Starting copy of evolvdso.teste with columns ['ref_equip', 'date', 'load', 'ptd_assoc'].
Traceback (most recent call last):
  File "/usr/local/bin/cqlsh", line 1133, in onecmd
    self.handle_statement(st, statementtext)
  File "/usr/local/bin/cqlsh", line 1170, in handle_statement
    return custom_handler(parsed)
  File "/usr/local/bin/cqlsh", line 1834, in do_copy
    rows = self.perform_csv_import(ks, cf, columns, fname, opts)
  File "/usr/local/bin/cqlsh", line 1846, in perform_csv_import
    csv_options, dialect_options, unrecognized_options = copyutil.parse_options(self, opts)


AttributeError: 'module' object has no attribute 'parse_options'

回答1:


Has the same issue when I use cqlsh from pip install cqlsh. Try just use cassandra's tool cqlsh

sudo docker run -it cassandra /usr/bin/cqlsh

Refer to jira




回答2:


I met a similar problem, the reason for my scenario is that the default cqlsh path is /usr/local/bin/cqlsh. (check with command $ which cqlsh)

Solution: using Cassandra shipped /usr/bin/cqlsh to connect the Cassandra server or run some command. For example, connect to Cassandra server using command:

$ /usr/bin/cqlsh <cassandra_listen_ip>

OR run command with

$ /usr/bin/cqlsh <cassandra_listen_ip> -e "<command>"


来源:https://stackoverflow.com/questions/40289324/cqlsh-client-module-object-has-no-attribute-parse-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!