数据湖探索 DLI-DWS结果表:示例

时间:2024-11-16 13:21:40

示例

  • 使用gsjdbc4驱动连接时,加载的数据库驱动类为:org.postgresql.Driver。该驱动为默认,创建表时可以不填该驱动参数。
    • 使用upsert模式,写入数据到DWS
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      create table dwsSink(
        car_id STRING,
        car_owner STRING,
        car_brand STRING,
        car_speed INT
      ) with (
        'connector.type' = 'gaussdb',
        'connector.url' = 'jdbc:postgresql://xx.xx.xx.xx:8000/xx',
        'connector.table' = 'car_info',
        'connector.username' = 'xx',
        'connector.password' = 'xx',
        'connector.write.mode' = 'upsert',
        'connector.write.flush.interval' = '30s'
      );
      
      当DWS表test在名为ads_game_sdk_base的schema下时,可以参考如下样例。
      CREATE TABLE ads_rpt_game_sdk_realtime_ada_reg_user_pay_mm (
        ddate DATE,
        dmin TIMESTAMP(3),
        game_appkey VARCHAR,
        channel_id VARCHAR,
        pay_user_num_1m bigint,
        pay_amt_1m bigint,
        PRIMARY KEY (ddate, dmin, game_appkey, channel_id) NOT ENFORCED
      ) WITH (
        'connector.type' = 'gaussdb',
        'connector.url' = 'jdbc:postgresql://xx.xx.xx.xx:8000/dws_bigdata_db',
        'connector.table' = 'ads_game_sdk_base\".\"test',
        'connector.username' = 'xxxx',
        'connector.password' = 'xxxxx',
        'connector.write.mode' = 'upsert',
        'connector.write.flush.interval' = '30s'
      );
  • 使用gsjdbc200驱动连接时,加载的数据库驱动类为:com.huawei.gauss200.jdbc.Driver。
    当DWS表test在名为ads_game_sdk_base的schema下时,可以参考如下样例。
    create table dwsSink(
      car_id STRING,
      car_owner STRING,
      car_brand STRING,
      car_speed INT
    ) with (
      'connector.type' = 'gaussdb',
      'connector.table' = 'ads_game_sdk_base\".\"test',
      'connector.driver' = 'com.huawei.gauss200.jdbc.Driver',
      'connector.url' = 'jdbc:gaussdb://xx.xx.xx.xx:8000/xx',
      'connector.username' = 'xx',
      'connector.password' = 'xx',
      'connector.write.mode' = 'upsert',
      'connector.write.flush.interval' = '30s'
    );
support.huaweicloud.com/sqlref-flink-dli/dli_08_0312.html