From f5a91c2ac2c98bb8c4d3bd6ba80afc56d9365fb5 Mon Sep 17 00:00:00 2001 From: admin <2775444633@qq.com> Date: Sun, 26 Apr 2026 15:24:11 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=2001=5Fstandards/naming=5Fco?= =?UTF-8?q?nvention.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01_standards/naming_convention.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/01_standards/naming_convention.md b/01_standards/naming_convention.md index e69de29..c5bfd3e 100644 --- a/01_standards/naming_convention.md +++ b/01_standards/naming_convention.md @@ -0,0 +1,16 @@ +# 命名规范 + +## 1. 数据库表命名规范 +* **贴源层 (ODS)**: `ods_{系统简写}_{表名}_[增量标识]`。例如:`ods_sakila_rental_di` (每日增量)。 +* **明细数据层 (DWD)**: `dwd_{业务域}_{粒度}_fact`。例如:`dwd_rental_transaction_fact`。 +* **维度层 (DIM)**: `dim_{维度名}`。例如:`dim_customer`, `dim_store`。 +* **汇总数据层 (DWS)**: `dws_{业务域}_{聚合维度}_{时间粒度}`。例如:`dws_rental_store_1d` (门店单日聚合)。 +* **应用数据层 (ADS)**: `ads_{应用场景}_{主题}`。例如:`ads_bi_store_performance`。 + +## 2. 字段命名规范 +* 所有字段必须小写,单词间使用下划线 `_` 分隔。 +* 主键后缀必须为 `_id` (如 `customer_id`)。 +* 时间类型后缀: + * 日期类型 (Date): `_date` (如 `rental_date`) + * 时间戳 (Timestamp): `_time` (如 `create_time`, `update_time`) +* 金额类型必须统一单位(本系统约定金额存入底层时单位统一为“元”,高精度计算保留两位小数)。 \ No newline at end of file