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

时间:2023-11-03 17:03:43

示例

  • 使用gsjdbc4驱动连接时,加载的数据库驱动类为:org.postgresql.Driver。该驱动为默认,创建表时可以不填该驱动参数。

    表car_info没有在schema下时。

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    create table dwsSource(
      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'
    );
    

    当DWS表test在名为test_schema的schema下时,可以参考如下样例。

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    create table dwsSource(
      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' = 'test_schema\".\"test',
      'connector.username' = 'xx',
      'connector.password' = 'xx'
    );
    
  • 使用gsjdbc200驱动连接时,加载的数据库驱动类为:com.huawei.gauss200.jdbc.Driver。
    当DWS表test在名为ads_game_sdk_base的schema下时,可以参考如下样例。
    create table dwsSource(
      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'
    );
support.huaweicloud.com/sqlreference-dli/dli_08_0304.html