Source: https://dev-docs.yueshu.com.cn/v5.3.2/utilities/exchange/config/sources/maxcompute/ Documentation version: v5.3.2 # MaxCompute 配置 本文介绍从 MaxCompute 数据源导入数据的配置项。关于完整配置文件和配置项的信息,请参见[数据导入配置](https://dev-docs.yueshu.com.cn/v5.3.2/utilities/exchange/config/)。 ## 数据源配置 []() 下表列出了 MaxCompute 数据源特定的配置项: | 选项 | 描述 | 类型 | 是否必选 | 默认值 | `type` | 数据源的类型。设置为`"maxcompute"`。 | String | 是 | 无 | `table` | 从中检索数据的 MaxCompute 表的名称。 | String | 是 | 无 | `project` | MaxCompute 项目的名称。 | String | 是 | 无 | `odpsUrl` | 访问 MaxCompute 的 URL。 | String | 是 | 无 | `tunnelUrl` | 访问 MaxCompute 隧道服务的 URL。 | String | 是 | 无 | `accessKeyId` | 访问 MaxCompute 的 AccessKey ID。 | String | 是 | 无 | `accessKeySecret` | 访问 MaxCompute 的 AccessKey 密钥。 | String | 是 | 无 | `partitionSpec` | MaxCompute 表的分区。 | String | 是 | 无 | `readParallel` | 允许的并发读请求数。 | Int | 否 | `32` ## 通用源配置 下列配置项也可以作为全局设置在配置文件的`sourcesCommon`一节指定: - `type` - `project` - `odpsUrl` - `tunnelUrl` - `accessKeyId` - `accessKeySecret` - `readParallel` 请注意,针对特定数据源的配置会覆盖全局设置。 ## 数据源配置示例 MaxCompute 源配置 ```` sources: [ { type: "maxcompute" table: movie project: project odpsUrl: "http://service.cn-hangzhou.maxcompute.aliyun.com/api" tunnelUrl: "http://dt.cn-hangzhou.maxcompute.aliyun.com" accessKeyId: xxx accessKeySecret: xxx partitionSpec: "dt='partition1',dd='partition2'" readParallel:32 // nodetypes: [] // edgetypes: [] } ] ```` ## 完整配置示例 将``替换为登录账号的当前密码。若已修改密码,请使用修改后的密码。 ```` { taskType: import nebula: { graphAddr: "127.0.0.1:9669" graphName: "movie" user: "root" passwd: "" } error: { path: "/tmp/errors" maxRecords: 10000 } checkPoint: { path: "/tmp/checkpoint" resume: false } sourcesCommon:{ type:"maxcompute" project: movie odpsUrl: "http://service.cn-hangzhou.maxcompute.aliyun.com/api" tunnelUrl: "http://dt.cn-hangzhou.maxcompute.aliyun.com" accessKeyId: xxx accessKeySecret: xxx readParallel:32 } writeCommon:{ batchSize: 2000 enableRealTimeQPSLog: true mode: "INSERT IGNORE" } sources: [ # node type Actor { table: actor partitionSpec: "dt='partition1'" pre_processes: { filter: ["birth_date!='\\N'"] concatConstant: [ { field: "name" prefixValue: "test_" suffixValue: "" } ] } nodetypes: [ { name: "Actor" sourceFields: [people_id,name,birth_date] nebulaFields: [id,name,birthDate] } ] } # node type Movie { table: movie partitionSpec: "dt='partition1'" nodetypes: [ { name: "Movie" sourceFields: [movie_id,name] nebulaFields: [id,name] } ] } # edge type Act { table: act partitionSpec: "dt='partition1'" edgetypes: [ { name: "Act" sourceKeys: [people_id] nebulaSrcKeys: [id] targetKeys: [movie_id] nebulaDstKeys: [id] sourceFields: [] nebulaFields: [] } ] } ] } ````