我计划使用 OCI Python SDK 在 OCI 上使用 Oracle NoSQL 云服务。我使用 API 调用做了一些测试,我想做同样的查询,但使用 Python SDK。
如何使用准备好的语句而不是常规语句(见下文)以及我需要设置哪些值
print("second attempt")
table_name = 'table1'
statement = 'declare $id integer; select * from ' + table_name + ' where id=$id'
id_value = '1'
#nosqlClient.prepare_statement(compartment_id=comp_ocid,statement=statement),
query_response = nosqlClient.query(
query_details=oci.nosql.models.QueryDetails(
compartment_id=comp_ocid,
statement=statement,
is_prepared=True,
consistency="EVENTUAL",
variables={
'$id': id_value}))# Get the data from response
print(query_response.data)
目前我有以下错误:
oci.exceptions.ServiceError:
{'opc-request-id': '94E0B7EA0C864B379D66ED1C5215652A',
'code': 'InvalidParameter',
'message': 'QUERY: Illegal Argument: Deserialize prep query failed: Hash provided for prepared query does not match payload', 'status': 400}