天天看點

阿裡雲Dataworks資料內建工具實作:OTS -> Maxcompute資料同步

Step By Step

1、配置資料源 + 測試連通性

  • 1.1 Table Store(OTS)參數擷取
    阿裡雲Dataworks資料內建工具實作:OTS -> Maxcompute資料同步
  • 1.2、AccessKey、AccessSecret擷取 阿裡雲常見參數擷取位置
  • 1.3 Dataworks資料內建配置OTS資料源
    阿裡雲Dataworks資料內建工具實作:OTS -> Maxcompute資料同步
  • 1.4 Maxcompute資料源配置
    阿裡雲Dataworks資料內建工具實作:OTS -> Maxcompute資料同步

2、源資料準備及目标表建立

  • 2.1 OTS 源資料表
    阿裡雲Dataworks資料內建工具實作:OTS -> Maxcompute資料同步
阿裡雲Dataworks資料內建工具實作:OTS -> Maxcompute資料同步
阿裡雲Dataworks資料內建工具實作:OTS -> Maxcompute資料同步
  • 2.2 odps資料表建立
CREATE TABLE otstoodps (id INT,name STRING);

3、建立資料內建任務(OTS資料源目前僅支援腳本模式)

  • 3.1 腳本Sample
{
    "type": "job",
    "steps": [
        {
            "stepType": "ots",
            "parameter": {
                "datasource": "otsdemo",
                "column": [
                    {
                        "name": "id"
                    },
                    {
                        "name": "name"
                    }
                ],
                "range": {
                    "end": [
                        {
                            "type": "INF_MAX"
                        }
                    ],
                    "begin": [
                        {
                            "type": "INF_MIN"
                        }
                    ]
                },
                "table": "otsreader2"
            },
            "name": "Reader",
            "category": "reader"
        },
        {
            "stepType": "odps",
            "parameter": {
                "partition": "",
                "truncate": true,
                "datasource": "odps_first",
                "column": [
                    "id",
                    "name"
                ],
                "emptyAsNull": false,
                "table": "otstoodps"
            },
            "name": "Writer",
            "category": "writer"
        }
    ],
    "version": "2.0",
    "order": {
        "hops": [
            {
                "from": "Reader",
                "to": "Writer"
            }
        ]
    },
    "setting": {
        "errorLimit": {
            "record": ""
        },
        "speed": {
            "concurrent": 2,
            "throttle": false
        }
    }
}           
  • 3.2 注意事項

a、ots Reader 表示将主鍵名也放在column中;

b、reader column的順序和writer column的順序要一緻。

4、測試運作 + 排程配置

  • 4.1 測試運作
    阿裡雲Dataworks資料內建工具實作:OTS -> Maxcompute資料同步
  • 4.2 目标表結果檢視
    阿裡雲Dataworks資料內建工具實作:OTS -> Maxcompute資料同步
  • 4.3 排程配置(測試運作成功後,可以配置周期排程,将任務送出到運維中心周期運作)
    阿裡雲Dataworks資料內建工具實作:OTS -> Maxcompute資料同步

參考連結

Table Store(OTS) Reader MaxCompute Writer