All Products
Search
Document Center

PolarDB:ST_SetAccessKey

Last Updated:Mar 28, 2026

Sets the AccessKey ID and AccessKey secret on a raster object so that PolarDB can read the object's data from Object Storage Service (OSS).

Prerequisites

Before you begin, ensure that you have:

  • A raster object stored in OSS

Syntax

raster ST_SetAccessKey(raster raster_obj, text id, text key, bool valid default true)

Parameters

ParameterDescription
raster_objThe raster object to update.
idThe AccessKey ID used to access OSS. If NULL, the existing AccessKey ID is kept.
keyThe AccessKey secret used to access OSS. If NULL, the existing AccessKey secret is kept.
validSpecifies whether to verify the validity of the logon information. Default: true.

Examples

The following example sets credentials on all rows in raster_table and verifies the result:

UPDATE raster_table
SET rast = ST_SetAccessKey(rast, 'OSS_ACCESSKEY_ID', 'OSS_ACCESSKEY_SECRET');

SELECT ST_AKId(rast) from raster_table;
     st_akid
------------------
 OSS_ACCESSKEY_ID