全部產品
Search
文件中心

PolarDB:ST_ImportObj

更新時間:Jul 06, 2024

將基於Object Storage Service或記憶體格式的Obj檔案匯入到資料庫中。

文法

boolean ST_ImportObj(text table_name,  text url,   text id,  text options default '{}');
boolean ST_ImportObj(text table_name,  bytea content,   text id,  text options default '{}');

傳回值

傳回值

描述

true

匯入成功。

false

匯入失敗。

參數

參數名稱

描述

table_name

obj表名及其拆分表首碼。

url

基於Object Storage Service服務的路徑。

id

obj唯一標識,目前使用字串形式的ID定義。

content

以二進位流方式提供的obj檔案。

options

匯入選項:

  • schema

  • search_path

  • ignore_missing

  • force_triangulate

  • metallic_roughness

  • obj_data_column

  • obj_id_column

描述

將基於Object Storage Service或記憶體格式的Obj檔案匯入到資料庫中。

  • 資料限制說明:

    僅支援diffusetexture類型的紋理,其他類型的紋理檔案將被忽略。

  • 匯入選項說明:

    參數名

    類型

    說明

    預設值

    樣本

    schema

    字串

    目標表schema。

    public

    postgres

    search_path

    字串

    手動指定材質/紋理的搜尋路徑。

    若通過URL指定OBJ檔案,則為OBJ對象的父路徑,否則為空白。

    OSS://foo/bar

    ignore_missing

    布爾

    遇到擷取不到的材質或紋理檔案是否忽略錯誤。

    true

    false

    force_triangulate

    布爾

    強制三角化非三角面。

    true

    false

    metallic_roughness

    布爾

    預設解析為metallic_roughness類型材質。設定為false時,則解析為 specular_glossiness類型材質。

    true

    false

    obj_data_column

    字串

    主表資料欄位。

    obj_data

    my_data

    obj_id_column

    字串

    主表資料ID欄位。

    obj_id

    my_id

    主表結構如下:

    欄位

    類型

    說明

    備忘

    id

    serial

    唯一ID。

    主鍵。

    [obj_id_column]

    text

    資料ID。

    欄位名可指定。預設為obj_id,值為使用者傳入。

    [obj_data_column]

    sfmesh

    資料。

    欄位名可指定。預設為obj_data。

    組件表結構如下:

    欄位

    類型

    說明

    備忘

    id

    serial

    唯一ID。

    主鍵。

    obj_id

    text

    資料ID。

    欄位名固定為obj_id,值為使用者傳入。

    component_id

    text

    組件ID。

    值為該組件在原始OBJ中的序號。

    name

    text

    組件名稱。

    值為OBJ檔案的group name或object name。如有多個,將取第一個。若不存在,則為Mesh_[對象序號]。

    tags

    jsonb

    tag。

    值為OBJ檔案的tags。

    component

    sfmesh

    組件。

    -

    紋理表結構如下:

    欄位

    類型

    說明

    備忘

    id

    serial

    唯一ID。

    主鍵。

    obj_id

    text

    資料ID。

    欄位名固定為obj_id,值為使用者傳入。

    texture_id

    text

    紋理ID。

    值為該紋理在原始obj檔案中的序號。

    name

    text

    紋理名稱。

    值為該紋理的檔案名稱。

    texture

    texture

    紋理。

    -

樣本

SELECT ST_ImportObj('test_obj', 'OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/path_to_obj.obj');

---------
t

關閉強制三角化匯入:

SELECT ST_ImportObj('test_obj', 'OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/path_to_obj.obj', '{"force_triangulate": false}');

---------
t