使用者場景:
使用者從其他資料庫同步資料檔案到OSS時,産生的檔案名,字尾通常會帶上随機的UUID資訊(如上圖),有些使用者不想要有這種字尾名稱的情況。
解決方案:
如果您不需要字尾随機的UUID,您可以配置一下writeSingleObject這個參數資訊:
"writeSingleObject" : "true"。
具體案例odps同步到oss腳本邏輯如下:
{
"type": "job",
"steps": [
{
"stepType": "odps",
"parameter": {
"partition": [
"pt=${bizdate}"
],
"datasource": "odps_first",
"column": [
"item_id",
"shop_id",
"utctimestamp",
"item_title",
"pic_url",
"pic_url_list",
"roperties",
"sale_time",
"cprice"
],
"table": "test_0526"
},
"name": "Reader",
"category": "reader"
},
{
"stepType": "oss",
"parameter": {
"fileName": "",
"datasource": "test_oss",
"writeSingleObject": "true",
"column": [
{
"name": "item_id",
"type": "BIGINT"
},
{
"name": "shop_id",
"type": "BIGINT"
},
{
"name": "sutctimestamp",
"type": "BIGINT"
},
{
"name": "item_title",
"type": "BIGINT"
},
{
"name": "pic_url",
"type": "BIGINT"
},
{
"name": "pic_url_list",
"type": "BIGINT"
},
{
"name": "properties",
"type": "BIGINT"
},
{
"name": "sale_time",
"type": "BIGINT"
},
{
"name": "cprice",
"type": "BIGINT"
}
],
"writeMode": "truncate",
"fieldDelimiter": "\t",
"encoding": "UTF-8",
"fileFormat": "csv",
"object": "test_detail_199"
},
"name": "Writer",
"category": "writer"
}
],
"version": "2.0",
"order": {
"hops": [
{
"from": "Reader",
"to": "Writer"
}
]
},
"setting": {
"errorLimit": {
"record": ""
},
"speed": {
"throttle": false,
"concurrent": 1
}
}
}
OSS結果展現:
配置完 writeSingleObject 這個參數,完成同步後,在OSS管理控制台看到的檔案結果如下:(可以看到顯示的檔案名,是以腳本中參數“object”配置的為準)
注意:
1、“writeSingleObject”參數目前隻對 csv、text檔案類型生效。
2、“writeSingleObject”參數各個資源組生效情況:
- 獨享資料內建資源組所有region都支援;
- 自定義資源組需要看Datax版本情況是否支援;
- 公共(預設)資源組國内region都支援,海外region不支援,因為海外region公共(預設)資源組版本比較低,會有設定了“writeSingleObject”這個參數,但是不生效的情況存在,建議使用獨享資料內建資源組跑同步任務。
DataWorks百問百答曆史記錄
請點選這裡檢視>>更多DataWorks技術和産品資訊,歡迎加入
【DataWorks釘釘交流群】