全部產品
Search
文件中心

PolarDB:ST_SetStorageLocation

更新時間:Jul 06, 2024

設定一個新的軌跡資料外部儲存位置。

文法

trajectory ST_SetStorageLocation(trajectory traj, text new_path, bool checkValid default true);

參數

參數名稱描述
traj軌跡對象。
new_path外部儲存字串,目前僅支援OSS檔案夾,格式為:'OSS://<access key>:<access secret>@<endpoint>/<bucket>/<directory>',軌跡檔案將儲存在對應檔案夾下的.gtf檔案中。
checkvalid是否需要驗證正確性,預設為true。如果為true,則嘗試用新設定的AccessKey訪問OSS,如果訪問失敗則報錯。

描述

更改軌跡外部儲存的位置。本函數不會移動原有的外部隱藏檔,如需使用,需要首先在OSS中移動儲存了軌跡外部資料的檔案夾,再通過此函數將軌跡重新指向新的儲存位置。

移動外部檔案後,可能出現向檔案插入軌跡時,無法插入並報錯某檔案出現is not appendable的情況。請確保最後一個分塊通過OSSAppend方式上傳。

樣本

select ST_SetStorageLocation(traj, '<New Path>') from trajs;
                                                                                                                                                                                                                                         st_setstoragelocation                                                                                                                                                                                                                                          
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 {"trajectory":{"version":1,"type":"STPOINT","leafcount":6,"start_time":"Sat Jan 01 03:15:42 2000","end_time":"Sat Jan 01 05:16:43 2000","spatial":"LINESTRING(2 2 0,33.042158099636 36.832684322819 0,47.244002354518 47.230026333034 0,64.978971942887 60.618813472986 0,77.621717839502 78.012496630661 0,80 78 0)","timeline":["Sat Jan 01 03:15:42 2000","Sat Jan 01 03:39:54 2000","Sat Jan 01 04:04:06 2000","Sat Jan 01 04:28:18 2000","Sat Jan 01 04:52:31 2000","Sat Jan 01 05:16:43 2000"]}}
 {"trajectory":{"version":1,"type":"STPOINT","leafcount":6,"start_time":"Sat Jan 01 03:15:42 2000","end_time":"Sat Jan 01 05:16:43 2000","spatial":"LINESTRING(2 2 0,33.042158099636 36.832684322819 0,47.244002354518 47.230026333034 0,64.978971942887 60.618813472986 0,77.621717839502 78.012496630661 0,80 78 0)","timeline":["Sat Jan 01 03:15:42 2000","Sat Jan 01 03:39:54 2000","Sat Jan 01 04:04:06 2000","Sat Jan 01 04:28:18 2000","Sat Jan 01 04:52:31 2000","Sat Jan 01 05:16:43 2000"]}}
 {"trajectory":{"version":1,"type":"STPOINT","leafcount":6,"start_time":"Sat Jan 01 03:15:42 2000","end_time":"Sat Jan 01 05:16:43 2000","spatial":"LINESTRING(2 2,33.042158099636 36.832684322819,47.244002354518 47.230026333034,64.978971942887 60.618813472986,77.621717839502 78.012496630661,80 78)","timeline":["Sat Jan 01 03:15:42 2000","Sat Jan 01 03:39:54 2000","Sat Jan 01 04:04:06 2000","Sat Jan 01 04:28:18 2000","Sat Jan 01 04:52:31 2000","Sat Jan 01 05:16:43 2000"]}}
 TRAJECTORY EMPTY
(4 rows)