我尝试使用以下代码但出现错误:
File "cassandra/cluster.py", line 1961,
in cassandra.cluster.Session.execute (cassandra/cluster.c:34076)
File "cassandra/cluster.py", line 3649,
in cassandra.cluster.ResponseFuture.result (cassandra/cluster.c:69755)
cassandra.cluster.NoHostAvailable:
('Unable to complete the operation against any hosts', {})
Run Code Online (Sandbox Code Playgroud)
我对 cassandra 有点陌生,如果有任何帮助,我会在我的大学代理后面使用它。
from cassandra.cluster import Cluster
cluster=Cluster(['127.0.0.1'],port=9042)
session=cluster.connect('demo')
session.execute(
"""
INSERT INTO users (name, credits)
VALUES (%s, %s)
""",
("John O'Reilly", 42)
)
Run Code Online (Sandbox Code Playgroud)