从datahub--streamingcomputer-tablestore

表格存储只需要定义key 不用写value 在下面定义value就可以

CREATE TABLE st_rsvrfsr_b (

    stcd VARCHAR,

    bgmd VARCHAR,

    edmd VARCHAR,

    fsltdz BIGINT,

    fsltdw BIGINT,

    fstp VARCHAR,

    moditime BIGINT

) WITH (

    type = 'datahub',

    endPoint = 'http://dh-cn-hangzhou.aliyun-inc.com',

    roleArn='acs:ram::1000282197418559:role/aliyunstreamdefaultrole',

    accessid = 'LTAIeU1xZf0aONp0',

    accesskey = 'GgUoc8tvv12YWWfm7eHQb1tjQo0qjg',

    project = 'slij',

    topic = 'st_rsvrfsr_b'

);

CREATE TABLE test_table5 (

    stcd VARCHAR,

    moditime BIGINT,

    bgmd VARCHAR,

    edmd VARCHAR,

    fsltdz BIGINT,

    fsltdw BIGINT,

    fstp VARCHAR,

    -- to add your columns...

    PRIMARY KEY(stcd,moditime)

) WITH (

    type= 'ots',

    endPoint = 'https://TabalStore2.cn-hangzhou.ots.aliyuncs.com',

    roleArn='acs:ram::1000282197418559:role/aliyunstreamdefaultrole',

    instanceName = 'TabalStore2',

    tableName = 'test_table5',

    valueColumns = 'bgmd,edmd,fsltdz,fsltdw,fstp' -- to add your columns

);

INSERT INTO test_table5

SELECT

t.stcd,

t.moditime,

t.bgmd,

t.edmd,

t.fsltdz,

t.fsltdw,

t.fstp

FROM st_rsvrfsr_b as t where t.stcd IS NOT NULL AND t.moditime IS NOT NULL

猜你喜欢

转载自blog.csdn.net/ying8933/article/details/81186201
今日推荐