跳到主要内容

TaCustomTableWriter 插件

最近更新 2026/10/03

一、快速介绍​

TACustomTableWriter 提供向 AE 系统创建自定义表功能。

在一些情况下,您需要运用到的数据可能无法以 user 或 event 的形式来表示,比如一些映射关系表,或者一些外部数据,如果需要运用这部分数据,则需要通过 TACustomTableWriter 插件导入自定义数据到 AE 系统中。

二、功能与限制​

仅支持 AE 系统的自定义表功能。

三、功能说明​

3.1 配置样例​

{
"job": {
"setting": {
"speed": {
"channel": 1
}
},
"content": [
{
"reader": {
"name": "streamreader",
"parameter": {
"column": [
{
"value": 123456,
"type": "long"
},
{
"value": "123123",
"type": "string"
},
{
"value": "pay",
"type": "string"
},
{
"value": "2020-01-01 08:08:08",
"type": "date"
},
{
"value": "2020-01-01 08:08:08",
"type": "date"
},
{
"value": "2222",
"type": "string"
},
{
"value": "2020-01-01 08:08:08",
"type": "date"
},
{
"value": "test",
"type": "string"
},
{
"value": true,
"type": "bool"
}
],
"sliceRecordCount": 10
}
},
"writer": {
"name": "ta-custom-table-writer",
"parameter": {
"appid": "6f9e64da5bc74792b9e9c1db4e3e3822",
"table": "ta_custom_table",
"tableDesc": "测试表",
"partitionValue": "2020-01-01",
"writeMode": "overwrite",
"column": [
{
"type": "double",
"name": "id"
},
{
"type": "string",
"name": "distinct_id"
},
{
"type": "string",
"name": "event_name"
},
{
"type": "string",
"name": "time"
},
{
"name": "event_time",
"type": "string"
},
{
"type": "string",
"name": "account_id"
},
{
"type": "string",
"name": "testDate"
},
{
"type": "string",
"name": "timetest2"
},
{
"type": "string",
"name": "os_1"
}
]
}
}
}
]
}
}

3.2 参数说明​

  • appid

    • 描述: 导入表对应的项目 appid,在 AE 系统后台可以查到得到,必须在系统中存在,并且没有下线的项目。
    • 类型: string
    • 必选:是
    • 默认值:无
  • table

    • 描述:导入到 AE 系统中的表名, 注意:表名全局不能重复,建议基于不同项目增加可以区分的前缀或后缀,表名只能为数字,字母,下划线组合
    • 类型: string
    • 必选:是
    • 默认值:无
  • tableDesc

    • 描述:导入表的注释,建议导入时配置该参数,方便后续查询表时明确表含义
    • 类型: string
    • 必选:否
    • 默认值:空
  • partitionValue

    • 描述:导入的分区值,AE 系统导入的自定义表默认都会带上分区字段 $pt ,所以在导入时必须指定导入的分区值,一般可以设定为导入的数据日期,例如: 20180701, 同时也支持时间宏替换,例如:@[{yyyyMMdd}-{1day}],具体使用方法可参考时间宏使用方法
    • 类型: string
    • 必选:是
    • 默认值:无
  • writeMode

    • 描述:TACustomTableWriter 写入前数据清理处理模式:

      • append,向partitionValue分区累加写入数据。
      • overwrite,删除partitionValue分区下已存在文件,然后写入本次导入的数据。
      • 必选:是
      • 默认值:无
  • column

    • 描述:写入数据的字段
    • 必选:是
    • 默认值:无
      • 其中:name 指定字段名,type 指定字段类型。

用户可以指定 Column 字段信息,配置如下:

"column":
[
{
"name": "userName",
"type": "string"
},
{
"name": "age",
"type": "long"
}
]

3.3 类型转换​

目前 TACustomTableWriter 支持 HIVE 类型,请注意检查你的类型。

下面列出 TACustomTableWriter 针对 HIVE 数据类型转换列表:

DataX 内部类型HIVE 数据类型
LongTINYINT,SMALLINT,INT,BIGINT
DoubleFLOAT,DOUBLE
StringSTRING,VARCHAR,CHAR
BooleanBOOLEAN
DateDATE,TIMESTAMP
这篇文档对你有帮助吗?