数据验证工具使用教程

数据验证工具使用教程

professional-services-data-validator Utility to compare data between homogeneous or heterogeneous environments to ensure source and target tables match professional-services-data-validator 项目地址: https://gitcode.com/gh_mirrors/pr/professional-services-data-validator

1. 项目目录结构及介绍

数据验证工具(Data Validation Tool,简称DVT)的目录结构如下:

.
├── .github
│   ├── ci
│   └── workflows
├── ci
├── data_validation
│   ├── __init__.py
│   ├── cli.py
│   ├── config.py
│   ├── connections.py
│   ├── validations.py
│   └── utils.py
├── docs
│   ├── Installation.md
│   ├── Usage.md
│   ├── Validation_Logic.md
│   ├── contributing.md
│   ├── code_of_conduct.md
│   └── license.md
├── samples
├── terraform
├── tests
│   ├── __init__.py
│   ├── test_cli.py
│   ├── test_config.py
│   ├── test_connections.py
│   ├── test_validations.py
│   └── test_utils.py
├── third_party/
│   └── ibis
├── .coveragerc
├── .flake8
├── .gitignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── RELEASING.md
├── SECURITY.md
├── cloudbuild.yaml
├── noxfile.py
├── setup.cfg
└── setup.py

主要目录和文件介绍:

  • .github: 包含GitHub Actions工作流文件,用于自动化测试和构建。
  • data_validation: 包含数据验证工具的核心Python代码。
  • docs: 存放项目的文档,包括安装、使用、贡献指南等。
  • samples: 示例配置文件和代码示例。
  • tests: 包含对数据验证工具的单元测试。
  • third_party: 存放第三方库的代码,如Ibis框架。
  • 其他文件:包括项目配置文件、构建脚本、许可证等。

2. 项目的启动文件介绍

项目的启动文件是data_validation/cli.py。这个文件定义了命令行界面的入口点,用户可以通过命令行来运行数据验证工具。以下是一个简单的命令行使用示例:

data-validation validate column --source-conn <source_connection> --target-conn <target_connection> --tables-list <table_mapping>

用户需要指定源连接和目标连接,以及要验证的表。

3. 项目的配置文件介绍

数据验证工具支持使用YAML或JSON格式的配置文件来存储验证配置。配置文件可以定义连接信息、验证规则、输出结果处理等。

YAML配置文件示例:

connections:
  source:
    type: postgres
    host: localhost
    port: 5432
    database: source_db
    user: user
    password: pass
  target:
    type: bigquery
    project_id: project-id
    dataset_id: dataset-id

validations:
  - type: column
    tables:
      - source_schema.table1:target_schema.table1
    aggregations:
      - count: '*'
      - sum: 'column1'
    result_handler: project-id.dataset.table

在这个配置文件中,定义了源和目标的连接信息,以及一个列验证规则,该规则对source_schema.table1target_schema.table1中的列进行计数和求和,并将结果存储在BigQuery中的project-id.dataset.table

用户可以根据需要创建自己的配置文件,并通过--config-file--config-file-json参数在命令行中指定配置文件的路径。

professional-services-data-validator Utility to compare data between homogeneous or heterogeneous environments to ensure source and target tables match professional-services-data-validator 项目地址: https://gitcode.com/gh_mirrors/pr/professional-services-data-validator

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

史霁蔷Primrose

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值