tianyu.chu d3b2239647 chore(bin): 删 bin/common/ 整目录 + 2 个 datax sh 壳 + dw_base no-op cow_says 1 tuần trước cách đây
..
ddl bff1ecfbb1 test(integration): 新增 hdfs_export 冒烟套件(PG 目标表 DDL + ini + README) 1 tuần trước cách đây
README.md d3b2239647 chore(bin): 删 bin/common/ 整目录 + 2 个 datax sh 壳 + dw_base no-op cow_says 1 tuần trước cách đây
export_user_cert_info.ini 468b3bffbf fix(datax): postgresql_writer 去 writeMode(DataX pg writer 不支持) 1 tuần trước cách đây

README.md

DataX hdfs-export 集成测试

端到端验证 Hive test.raw_usr_app_user_cert_info_inc_d(dt=20260422 分区)→ PG test.ads_usr_app_user_cert_info_export 回写。

闭环:先前 hive-import 冒烟把 PG public.app_user_cert_info 同步到 Hive raw 分区;本冒烟再把 Hive raw 分区数据回写到 PG 另一张表,验证 datax-hdfs-export-starter 端到端。

前置条件

  • hive-import 冒烟已通过,Hive test.raw_usr_app_user_cert_info_inc_ddt=20260422 分区里有数据
  • PG dev-poyee-xiaoxu 实例对 hs_sync_datatest schema 有写权限
  • 项目代码 + datasource/ + /opt/datax 同步到 cdhmaster02 / cdhnode01-03
  • bigdata 用户、发布目录下执行(-random 生效所需)

执行步骤

  1. 在 PG 执行 ddl/pg_target.sql 建目标表(含 CREATE SCHEMA IF NOT EXISTS test + 建表)
  2. 跑 DataX:

    python3 bin/datax-hdfs-export-starter.py \
      -ini tests/integration/datax/hdfs_export/export_user_cert_info.ini \
      -start-date 20260422 -stop-date 20260423 \
      -random
    

    (start-date 用作 hdfsreader 的 ${dt} 占位符替换,读 Hive 分区 dt=20260422

预期

  • PG test.ads_usr_app_user_cert_info_export 表被 TRUNCATE 后插入数据
  • 行数 = Hive test.raw_usr_app_user_cert_info_inc_ddt=20260422 分区行数
  • cert_birthday 字段值形如 "1990-05"(Hive raw 层已脱敏到月)
  • 不存在 user_cert_data / cert_no / cert_real_name 三个敏感字段(原本就没同步进 Hive)

验证 SQL

PG 侧:

SELECT COUNT(*) FROM test.ads_usr_app_user_cert_info_export;
SELECT id, user_id, cert_birthday, create_time
FROM test.ads_usr_app_user_cert_info_export
LIMIT 5;

Hive 侧对比:

SELECT COUNT(*) FROM test.raw_usr_app_user_cert_info_inc_d WHERE dt='20260422';

两边 COUNT 一致 = 冒烟通过。

相关文件

  • ddl/pg_target.sql:PG 目标表建表 SQL
  • export_user_cert_info.ini:DataX ini