You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

OCI NoSQL Python SDK执行含count、group by、order by的预编译查询时提示不支持复杂查询的问题求助

OCI NoSQL Python SDK执行含count、group by、order by的预编译查询时提示不支持复杂查询的问题求助

我尝试用Python SDK操作Oracle Cloud的NoSQL数据库,写了一个包含count统计的预编译查询,代码如下:

nosql_client = oci.nosql.NosqlClient(config)
query = """
declare 
$orgKey string;

SELECT count(*) FROM log_table WHERE orgKey = $orgKey
"""
orgKey = "HV411"

try:    
    prepare_statement_response = nosql_client.prepare_statement(
    compartment_id=compartment_ocid,
    statement = query
    )
    rows_response = nosql_client.query(
    query_details=oci.nosql.models.QueryDetails(
    compartment_id=compartment_ocid,
    is_prepared = True,
    statement=prepare_statement_response.data.statement,
    consistency="EVENTUAL",
    variables = {
    '$orgKey':orgKey,
    }
    ),
    )
    print(rows_response)
except (Exception, ValueError) as ex:
    print('Failed to execute the query ' + str(ex))

执行这段代码后,我遇到了如下错误:

Failed to execute the query {'target_service': 'nosql', 'status': 400, 'code': 'InvalidParameter', 'opc-request-id': 'C1C23D2C3D22487EBD183DA8B4A27BD2', 'message': 'PREPARE: Illegal Argument: The driver or SDK being used does not support complex query.', 'operation_name': 'prepare_statement', 'timestamp': '2025-03-20T07:12:23.055327+00:00', 'client_version': 'Oracle-PythonSDK/2.149.0', 'request_endpoint': 'GET https://nosql.me-jeddah-1.oci.oraclecloud.com/20190828/query/prepare', 'logging_tips': 'To get more info on the failing request, refer to https://docs.oracle.com/en-us/iaas/tools/python/latest/logging.html for ways to log the request/response details.', 'troubleshooting_tips': "See https://docs.oracle.com/iaas/Content/API/References/apierrors.htm#apierrors_400__400_invalidparameter for more information about resolving this error. Also see https://docs.oracle.com/iaas/api/#/en/nosql-database/20190828/QueryResultCollection/PrepareStatement for details on this operation's requirements. If you are unable to resolve this nosql issue, please contact Oracle support and provide them this full error message."}

另外,当我使用group by或者order by语法的时候,也会触发完全相同的错误。有没有大佬能帮忙看看这是什么问题,该怎么解决呢?

备注:内容来源于stack exchange,提问作者Elyas Salah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.13 19:43:00