CREATE TABLE tableName(
colName colType,
...
colNameX colType,
[primary key (colName)]
)WITH(
type ='mysql',
url ='jdbcUrl',
userName ='userName',
password ='pwd',
tableName ='tableName',
parallelism ='parllNum'
);
CREATE TABLE MyTable(
id int,
channel varchar,
pv varchar,
xctime varchar,
name varchar
)WITH(
type ='kafka10',
bootstrapServers ='172.16.8.107:9092',
zookeeperQuorum ='172.16.8.107:2181/kafka',
offsetReset ='latest',
topic ='es_test',
timezone='Asia/Shanghai',
topicIsPattern ='false',
parallelism ='1'
);
CREATE TABLE MyResult(
pv VARCHAR,
channel VARCHAR
)WITH(
type ='mysql',
url ='jdbc:mysql://172.16.10.134:3306/test',
userName ='dtstack',
password ='abc123',
tableName ='myresult',
parallelism ='1'
);
insert
into
MyResult
select
channel,
pv
from
MyTable
mysql> desc myresult;
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| channel | varchar(255) | YES | | NULL | |
| pv | varchar(11) | YES | | NULL | |
+---------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> select * from myresult limit 1;
+---------+------+
| channel | pv |
+---------+------+
| aa | mq6 |