开发者社区> 问答> 正文

如何在vvp作业中定义Hologres作为数据汇(Sink)的临时表?

如何在vvp作业中定义Hologres作为数据汇(Sink)的临时表?

展开
收起
真的很搞笑 2024-08-13 22:58:16 17 0
1 条回答
写回答
取消 提交回答
  • "在vvp作业中定义Hologres作为数据汇(Sink)的临时表,可以使用以下SQL代码:

    sql复制代码
     CREATE TEMPORARY TABLE consume( 
     appkey STRING, 
     serverid STRING, 
     servertime STRING, 
     roleid STRING, 
     amount DOUBLE, 
     dt STRING, 
     PRIMARY KEY (appkey,dt) NOT ENFORCED 
     ) WITH ( 
     'connector' = 'hologres', 
     'dbname' = 'mydb', 
     'endpoint' = 'hgprecn-cn-tl32gkaet006-cn-beijing-vpc.hologres.aliyuncs.com:80', 
     'password' = '[your appkey secret]', 
     'tablename' = 'consume', 
     'username' = '[your app key]', 
     'mutateType' = 'insertorreplace' 
     );
     --""appkey"":""appkey1"",""servertime"":""2020-09-30
     14:10:36"",""consumenum"":33.8,""roleid"":""roleid1"",""serverid"":""1""
     --""appkey"":""appkey2"",""servertime"":""2020-09-30 14:11:36"",""consumenum"":30.8,""roleid"":""roleid2"",""serverid"":""2""
     --""appkey"":""appkey1"",""servertime"":""2020-09-30 14:13:36"",""consumenum"":31.8,""roleid"":""roleid1"",""serverid"":""1""
     --""appkey"":""appkey2"",""servertime"":""2020-09-30 14:20:36"",""consumenum"":33.8,""roleid"":""roleid2"",""serverid"":""2""
     --""appkey"":""appkey1"",""servertime"":""2020-09-30 14:30:36"",""consumenum"":73.8,""roleid"":""roleid1"",""serverid"":""1""
    

    这段SQL代码定义了一个名为consume的临时表,它连接到Hologres数据库的一个表,用于将处理后的数据写入。这里配置了Hologres的连接信息、数据库名、表名以及数据写入的方式(insertorreplace)。"

    2024-08-13 23:39:48
    赞同 4 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
实时数仓Workshop(广州站)- 李佳林 立即下载
阿里云实时数仓Hologres技术揭秘2.0 立即下载
实时数仓Hologres技术实战一本通2.0版(下) 立即下载