我已经按照官方文档用 ScyllaDB 设置了 Docker 容器。我创建了键空间和表。现在我想在这个表中插入一些数据。我想知道我可以这样做吗?我找到了例子:
import cql
con = cql.connect('localhost', 9160, 'logs', cql_version='3.0.0')
print ("Connected!")
cursor = con.cursor()
CQLString = "INSERT INTO event_attend (event_id, event_type, event_user_id) VALUES (131, 'Party', 3156);"
cursor.execute(CQLString)
但是我得到如下所示的错误。我找不到任何示例来说明如何使用 Docker 完成。有任何想法吗?
No handlers could be found for logger "thrift.transport.TSocket"
Traceback (most recent call last):
File "scylla_test.py", line 2, in <module>
con = cql.connect('localhost', 9160, 'logs', cql_version='3.0.0')
File "/usr/local/lib/python2.7/dist-packages/cql/connection.py", line 143, in connect
consistency_level=consistency_level, transport=transport)
File "/usr/local/lib/python2.7/dist-packages/cql/connection.py", line 59, in __init__
self.establish_connection()
File "/usr/local/lib/python2.7/dist-packages/cql/thrifteries.py", line 151, in establish_connection
self.transport.open()
File "/usr/local/lib/python2.7/dist-packages/thrift/transport/TTransport.py", line 271, in open
return self.__trans.open()
File "/usr/local/lib/python2.7/dist-packages/thrift/transport/TSocket.py", line 113, in open
raise TTransportException(TTransportException.NOT_OPEN, msg)
thrift.transport.TTransport.TTransportException: Could not connect to any of [('::1', 9160, 0, 0), ('127.0.0.1', 9160)]