雲計算

DataWorks百問百答29:數據寫入OSS,有哪些不需要後綴隨機UUD的場景?

用戶場景:

292.png

用戶從其他數據庫同步數據文件到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”配置的為準)

291.png

注意:
1、“writeSingleObject”參數目前只對 csv、text文件類型生效。
2、“writeSingleObject”參數各個資源組生效情況:

  •  獨享數據集成資源組所有region都支持;
  •  自定義資源組需要看Datax版本情況是否支持;
  •  公共(默認)資源組國內region都支持,海外region不支持,因為海外region公共(默認)資源組版本比較低,會有設置了“writeSingleObject”這個參數,但是不生效的情況存在,建議使用獨享數據集成資源組跑同步任務。

DataWorks百問百答歷史記錄 請點擊這裡查看>>

更多DataWorks技術和產品信息,歡迎加入【DataWorks釘釘交流群】

Leave a Reply

Your email address will not be published. Required fields are marked *