szk108 commented on issue #2861:
URL: 
https://github.com/apache/incubator-streampark/issues/2861#issuecomment-1637352600

   CREATE TABLE test_out(
   product_id varchar PRIMARY KEY not enforced,
   product_name varchar
   )with(
   'connector' = 'jdbc',
   'driver= 'org.postgresql.Driver",
   'url' ='jdbc:postgresql://gp.....',
   'username' = 'xxxxxxx',
   'password' = "xxxxxxx",
   'table-name'='test_out'
   );
   
   CREATE TABLE test_customer_output(
   'id' int PRIMARY KEY not enforced,
   start_time timestamp ,
   card_id varchar(20) ,
   event varchar(20),
   'day' int,
   amount decimal(16,2)
   ) with (
   'connector' = 'jdbc',
   'url’= "jdbc:mysql://xxxxx
   'username'= xxxxxx,
   'password’= xxxxx,
   'table-name” = 'test_customer_output'
   );
   
   --测试upsert功能
   --  insert into test_out values ('a','b'),('a','c') on conflict(product_id) 
do update set product_name = excluded.product_name';
   --  insert into test_customer_output values(348,'2023-04-28 
09:15:31.0',aa','bb',27,1818),(348,'2023-04-28 09:15:31.0','aaa','cct',27,1818)
   --  on duplicate key update
   --  id= values(id),
   --  start_time = values(start time),
   --  card_id=values(card id),
   --  eyent = values(event),
   --  'day'=values('day'),
   --  amount = values(amount)
   --  ;
   
   --测试正常插入数据按主键更新
   insert into testout values ('a','b'),('a',c');
   insert into test customer output values(348,'2023-04-28 09:15:31.0', 'aa' 
,'bbb',27,1818),(348,'2023-04-28 09:15:31.0','aa','ccc',27,1818);


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to