使用 python 客户端。
我得到一个连接,然后提交一个带有硬编码参数 arg 数据的插入语句。然而得到一个错误。
from crate import client
con = client.connect("http://webservicesbigmac.richmond.edu:4200")
cursor = con.cursor()
print cursor
cursor.execute("INSERT INTO logs (client_ip) VALUES (?)", ("66.249.67.49"))
我可以在崩溃客户端中运行此查询并且它可以工作
cr> INSERT INTO 日志 (client_ip) 值 ('66.249.67.49');
INSERT OK,1 行受影响(0.001 秒)
我确定我做错了什么,只是不确定它是什么。
这个堆栈跟踪
<crate.client.cursor.Cursor object at 0x10e40bcd0>
Traceback (most recent call last):
File "/Users/epalmer/projects/cratedbload/sqlload2.py", line 11, in <module>
cursor.execute("INSERT INTO logs (client_ip) VALUES (?)", ("66.249.67.49"))
File "/Library/Python/2.7/site-packages/crate/client/cursor.py", line 51, in execute
self._result = self.connection.client.sql(sql, parameters, bulk_parameters)
File "/Library/Python/2.7/site-packages/crate/client/http.py", line 202, in sql
content = self._json_request('POST', self.path, data=data)
File "/Library/Python/2.7/site-packages/crate/client/http.py", line 362, in _json_request
self._raise_for_status(response)
File "/Library/Python/2.7/site-packages/crate/client/http.py", line 348, in _raise_for_status
raise ProgrammingError(error.get('message', ''), error_trace=error_trace)
crate.client.exceptions.ProgrammingError: SQLActionException[Failed to parse source [{"args": "66.249.67.49", "stmt": "INSERT INTO logs (client_ip) VALUES (?)"}]]