You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our QA are getting error 404 when they want to access object with a slash "/" (aka directory in objectstorage) via queryservice (not yet released).
But when accessing the same object via OCI Java SDK, it works correctly.
We realized that the problem is that the parameter is not URL-encoded by Python OCI SDK client, or it is encoded, but without "/" character.
In the base_client.py, there is a line calling this function to URL-encode parameters:
urllib.parse.quote(string, safe='/', encoding=None, errors=None)
Replace special characters in string using the %xx escape. Letters, digits, and the characters '_.-~' are never quoted. By default, this function is intended for quoting the path section of a URL. The optional safe parameter specifies additional ASCII characters that should not be quoted — its default value is '/'.
We think that the line above should be fixed like this - to encode all chars, including "/":
Illustration of our problem (see "url" values in the requests):
We get error for object "vector/0001.parquet":
$ ./get-schema.py
Get schema for Object oraclebigdatadb/test-bucket-parquet/vector/0001.parquet
Sending request......
{ 'body': None,
'enforce_content_headers': True,
'header': { 'accept': 'application/json',
'content-type': 'application/json',
'opc-client-info': 'Oracle-PythonSDK/2.149.2+preview.1.178',
'opc-client-retries': 'true',
'opc-request-id': '2032EC3DDEB94E08B6E966B22EC2E9B8',
'user-agent': 'Oracle-PythonSDK/2.149.2+preview.1.178 (python '
'3.10.12; x86_64-Linux)'},
'method': 'POST',
'query_params': None,
'response_type': 'ObjectSchema',
'url': 'https://query.sql.us-ashburn-1.oci.oraclecloud.com/20210831/projects/ocid1.queryserviceproject.oc1.iad.amaaaaaayrywvyyaoa3pka3cmnzbtaziiifo3evmgdzbltu6o3ky5vakyg4a/n/oraclebigdatadb/b/test-bucket-parquet/o/vector/0001.parquet/actions/getObjectSchema'}
Receiving response......
{ 'header': { 'Content-Length': '111',
'Content-Type': 'application/json',
'Date': 'Thu, 27 Mar 2025 17:52:02 GMT',
'Strict-Transport-Security': 'max-age=31536000; '
'includeSubDomains;',
'opc-request-id': '2032EC3DDEB94E08B6E966B22EC2E9B8/8169B56501935D3576428A8343B97912/540299E593A8BEEF29A193812FCED43A'},
'reason': 'Not Found',
'status_code': 404,
'url': 'https://query.sql.us-ashburn-1.oci.oraclecloud.com/20210831/projects/ocid1.queryserviceproject.oc1.iad.amaaaaaayrywvyyaoa3pka3cmnzbtaziiifo3evmgdzbltu6o3ky5vakyg4a/n/oraclebigdatadb/b/test-bucket-parquet/o/vector/0001.parquet/actions/getObjectSchema'}
Error: {'target_service': 'query', 'status': 404, 'code': 'NotAuthorizedOrNotFound', 'opc-request-id': '2032EC3DDEB94E08B6E966B22EC2E9B8/8169B56501935D3576428A8343B97912/540299E593A8BEEF29A193812FCED43A', 'message': 'Authorization failed or requested resource not found.', 'operation_name': 'get_object_schema', 'timestamp': '2025-03-27T17:52:02.763638+00:00', 'client_version': 'Oracle-PythonSDK/2.149.2+preview.1.178', 'request_endpoint': 'POST https://query.sql.us-ashburn-1.oci.oraclecloud.com/20210831/projects/ocid1.queryserviceproject.oc1.iad.amaaaaaayrywvyyaoa3pka3cmnzbtaziiifo3evmgdzbltu6o3ky5vakyg4a/n/oraclebigdatadb/b/test-bucket-parquet/o/vector/0001.parquet/actions/getObjectSchema', '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_404__404_notauthorizedornotfound for more information about resolving this error. If you are unable to resolve this query issue, please contact Oracle support and provide them this full error message.'}
Our QA are getting error 404 when they want to access object with a slash "/" (aka directory in objectstorage) via queryservice (not yet released).
But when accessing the same object via OCI Java SDK, it works correctly.
We realized that the problem is that the parameter is not URL-encoded by Python OCI SDK client, or it is encoded, but without "/" character.
In the base_client.py, there is a line calling this function to URL-encode parameters:
The problem is that function to URL encode parameters ignore "/" character by default (so it can be used on URL-like strings). See docs: https://docs.python.org/3/library/urllib.parse.html
We think that the line above should be fixed like this - to encode all chars, including "/":
Illustration of our problem (see "url" values in the requests):
The text was updated successfully, but these errors were encountered: