40 lines
1.5 KiB
Markdown
40 lines
1.5 KiB
Markdown
# 数据字典查询
|
|
|
|
用于按中文业务含义查询天软数据字典中的表、数据源或字段。它们不是可调用 API,
|
|
不进入 `function_index.tsv`。
|
|
|
|
先查看脚本当前契约:
|
|
|
|
```bash
|
|
python <this-skill-dir>/scripts/dictionary_lookup.py --help
|
|
```
|
|
|
|
## 查询
|
|
|
|
```bash
|
|
python <this-skill-dir>/scripts/dictionary_lookup.py \
|
|
--query "股票现金流指标销售现金比率"
|
|
python <this-skill-dir>/scripts/dictionary_lookup.py --query "市值" --scope fund
|
|
python <this-skill-dir>/scripts/dictionary_lookup.py --query "买一量" --table TradeTable
|
|
python <this-skill-dir>/scripts/dictionary_lookup.py --query "9900700" --field 销售现金比率
|
|
```
|
|
|
|
结果包含表或数据源名称、表 ID、字段名称、字段 ID、类型、单位、提取方式、访问代码、
|
|
对应 API 和字典页面。
|
|
|
|
## 状态判读
|
|
|
|
- `status: ok`:最高分候选唯一。
|
|
- `status: ambiguous`:存在多个同分候选;列出候选并请用户补充 scope、表或数据源范围,
|
|
不能默认选第一条。
|
|
- `status: no_match`:数据字典无匹配,不能改述为 API 的 `not found`。
|
|
|
|
标识符匹配保留下划线;同义词只来自 `dictionary_lexicon.json` 的受控映射。
|
|
`MarketTable` 和 `TradeTable` 是 TS-SQL 数据源,不是函数。
|
|
|
|
## 退出码
|
|
|
|
- rc=0:查询完成,实际结果由 `status` 判定,包括 `ambiguous` 和 `no_match`。
|
|
- rc=1:字典索引或词表缺失、损坏、格式错误。
|
|
- rc=2:参数不合法。
|