Add your description here
Project description
xaudit 用法
命令
xaudit CONFIG_PATH
读取单个 .sql 或 .txt 配置文件,生成 HTML 报告。默认输出到当前目录,文件名为 <配置文件名>.html。
xaudit CONFIG_PATH --output report.html
xaudit CONFIG_PATH -o report.html
读取单个配置文件,并把报告写入指定路径。--output 只能和单个配置文件一起使用,不能用于目录扫描。
xaudit DIRECTORY
按文件名顺序扫描目录第一层的 .sql 和 .txt 配置文件,并在该目录下分别生成 <配置文件名>.html。
xaudit
扫描当前目录第一层的 .sql 和 .txt 配置文件。
xaudit --version
查看版本号。
配置文件格式
配置文件使用 .sql 或 .txt 后缀。每个配置块之间用 ---- 分隔。
- 必须定义两个
-- connection:块;第一个连接用于每个对比的第一段 SQL,第二个连接用于第二段 SQL。 -- url:必须是完整的字面量数据库 URL,不能写环境变量。- 每个
-- compare:块必须包含两个以分号结束的 SQL 语句。 -- tolerance:可作为全局容差,也可写在单个-- compare:块中覆盖全局容差。-- param:支持固定值列表或查询结果;参数名只能使用大写字母、数字和下划线。- SQL 中使用
{{PARAM_NAME}}引用参数;多个参数会按笛卡尔积展开为多个对比。 -- rule:格式为<expression> => <result>,结果支持字符串、IGNORE、NONE。
最简范例
保存为 amount_check.sql:
-- connection: FA
-- url: postgresql://user:password@localhost:5432/source_db
----
-- connection: IBOR
-- url: postgresql://user:password@localhost:5432/target_db
----
-- compare: amount_check
select id, amount
from source_amount;
select id, amount
from target_amount;
运行:
xaudit amount_check.sql --output amount_check.html
全功能范例
保存为 full_check.sql:
-- connection: FA
-- url: postgresql://ibor_user:ibor_user@localhost:5432/ibor-demo
----
-- connection: IBOR
-- url: postgresql://ibor_user:ibor_user@localhost:5432/ibor-demo
----
-- tolerance: 0.01
----
-- param: TRADE_DATE
-- values: 20260604,20260605
----
-- param: PORTFOLIO_ID
-- connection: IBOR
select distinct portfolio_id
from irmp.ibor_bond_position
where trade_date in (20260604, 20260605)
and secu_code like '%HK'
and calc_basis = '1'
and invest_type = '1';
----
-- compare: total_pnl
-- tolerance: 0.001
-- rule: abs(FA['ytd_total_pnl'] - IBOR['ytd_total_pnl']) < 1 => "rounding difference"
-- rule: FA['trade_date'] == IBOR['trade_date'] => IGNORE
select
cast(replace(enddate, '-', '') as int) as trade_date,
concat(t1.stkid, '.', 'HK') as secu_code,
'XIR_' || book as portfolio_id,
reportpl as ytd_total_pnl
from ods_faas.bd_ods_faas_glhs_bond_rpt_nxt_his t1
where cast(replace(enddate, '-', '') as int) = {{TRADE_DATE}}
and 'XIR_' || book = {{PORTFOLIO_ID}};
select
trade_date,
portfolio_id,
secu_code,
ytd_total_pnl
from irmp.ibor_bond_position
where secu_code like '%HK'
and trade_date = {{TRADE_DATE}}
and portfolio_id = {{PORTFOLIO_ID}}
and calc_basis = '1'
and invest_type = '1';
运行:
xaudit full_check.sql --output full_check.html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ibor_audit_tool-0.1.7.tar.gz.
File metadata
- Download URL: ibor_audit_tool-0.1.7.tar.gz
- Upload date:
- Size: 45.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bf83e7c99229af11e8d02faf8577a884d11c4d8d19c83416ad7b611790dd255
|
|
| MD5 |
a4b040a4ec3cd2dc54c44168eae6b237
|
|
| BLAKE2b-256 |
b53073c439a2eaeb13a3a113e6e46ead18b4903f8c7da92095646a147edc7541
|
File details
Details for the file ibor_audit_tool-0.1.7-py3-none-any.whl.
File metadata
- Download URL: ibor_audit_tool-0.1.7-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
650cf3998dc13a3650593834ccbe27d4dca3beb9dc05b1a93e006708f3f43cba
|
|
| MD5 |
61e0bebdf496179373595984ba89bbed
|
|
| BLAKE2b-256 |
e10bc22f786f842f401ddeb44c92f4e1a9f9f90882ae56bcb7cd0eb18a4a2b09
|