模型规划
    更新时间: 2024-07-08 02:04:02
    
    阅读 321
    
模型设计
注:该部分不涉及产品页面上的操作,仅为设计阶段的需求结果。如需查阅相关创建操作步骤,请参考后续部分。
主题域
| 一级主题域 | 二级主题域 | 备注 | 
|---|---|---|
| 客户域(customer) | 客户(cus) | 注册用户的各种基础信息 | 
| 交易域(trade) | 订单(order) | 各个渠道的交易订单 | 
| 产品域(product) | 商品(item) | 售卖产品和商品数据,包括产品类目、品牌、SKU等 | 
分层
注:以下SQL语句请勿执行!
ODS层
订单表_全量抽取(ods_order_info_df):
CREATE TABLE `库名`.`ods_order_info_df`(
  order_id string COMMENT '订单ID', 
  cus_id bigint COMMENT '客户ID', 
  item_id bigint COMMENT '商品ID', 
  qty int COMMENT '数量', 
  amount decimal(38,6) COMMENT '总额',
  order_date date COMMENT '订单日期')
comment '订单表_全量抽取'
partitioned by(dt string comment '日期');订单表_增量抽取(ods_order_info_di):
CREATE TABLE `库名`.`ods_order_info_di`(
  order_id string COMMENT '订单ID', 
  cus_id bigint COMMENT '客户ID', 
  item_id bigint COMMENT '商品ID', 
  qty int COMMENT '数量', 
  amount decimal(38,6) COMMENT '总额',
  order_date date COMMENT '订单日期')
comment '订单表_增量抽取'
partitioned by(dt string comment '日期');商品表(ods_item_info_df):
CREATE TABLE `库名`.`ods_item_info_df`(
  item_id bigint COMMENT '商品ID',
  item_name string COMMENT '商品名称',
  brand string COMMENT '品牌')
comment '商品表'
partitioned by(dt string comment '日期');客户表(ods_cus_info_df):
CREATE TABLE `库名`.`ods_cus_info_df`(
  cus_id int COMMENT '客户ID', 
  cus_name string COMMENT '客户名称', 
  age int COMMENT '年龄', 
  address string COMMENT '地址',
  ip string COMMENT 'IP地址',
  id_card string COMMENT '身份证号')
comment '客户表'
partitioned by(dt string comment '日期');DWD层
商品订单客户表(dwd_trade_order_df)
CREATE TABLE `库名`.`dwd_trade_order_df`(
  `order_id` string COMMENT '订单编号',
  `cus_id` string COMMENT '客户编号',
  `cus_name` string COMMENT '客户名称',
  `age` bigint COMMENT '年龄',
  `item_id` string COMMENT '商品编号',
  `item_qty` bigint COMMENT '商品数量',
  `item_amt` decimal(38,6) COMMENT '商品总额',
  `order_date` string COMMENT '订单日期',
  `item_name` string COMMENT '商品名称',
  `cus_address` string COMMENT '客户地址',
  `ip` string COMMENT '网络地址',
  `id_card` string COMMENT '身份证号',
  `brand` string COMMENT '品牌'
)
comment  '商品订单客户表
partitioned by(dt string comment '日期');DIM层
客户维表(dim_customer_cus_info_df)
CREATE TABLE `库名`.`dim_customer_cus_info_df`(
  `cus_id` string COMMENT '客户编号', 
  `cus_name` string COMMENT '客户名称', 
  `age` bigint COMMENT '年龄', 
  `cus_address` string COMMENT '客户地址', 
  `ip` string COMMENT '网络地址', 
  `id_card` string COMMENT '身份证号'
)
comment  '客户维表'
partitioned by(dt string comment '日期');商品维表(dim_product_item_info_df)
CREATE TABLE `库名`.`dim_product_item_info_df`(
  `item_id` bigint COMMENT '商品编号', 
  `item_name` string COMMENT '商品名称', 
  `brand` string COMMENT '品牌'
)
comment '商品维表'
partitioned by(dt string comment '日期');DWS层
客户下单商品每日汇总表(dws_trade_order_cus_1d)
CREATE TABLE `库名`.`dws_trade_order_cus_1d`(
  `order_date` date COMMENT '订单日期', 
  `cus_id` string COMMENT '客户编号', 
  `cus_name` string COMMENT '客户名称', 
  `age` bigint COMMENT '年龄', 
  `item_id` bigint COMMENT '商品编号', 
  `item_qty` bigint COMMENT '商品数量', 
  `item_amt` decimal(38,6) COMMENT '商品总额', 
  `item_name` string COMMENT '商品名称', 
  `brand` string COMMENT '品牌'
)
comment  '客户下单商品每日汇总表'
partitioned by(dt string comment '日期');ADS层
客户各年龄分组行为分析表(ads_customer_cusanalysis_df)
CREATE TABLE `库名`.`ads_customer_cusanalysis_df`(
CREATE TABLE `poc_standard`.`ads_customer_cusanalysis_df`(
  `age_grp` string COMMENT '年龄分组', 
  `age_group_cus_qty_td` bigint COMMENT '截至今日各年龄分组客户数', 
  `age_group_item_qty_td` bigint COMMENT '截至今日各年龄分组商品数量', 
  `age_group_order_amt_td` decimal(38,6) COMMENT '截至今日各年龄分组订单金额'
)
comment '客户各年龄分组行为分析表表'
partitioned by(dt string comment '日期');各品牌销售分析表(ads_product_brand_cusanalysis_df)
CREATE TABLE `库名`.`ads_product_brand_cusanalysis_df`(
  `brand` string COMMENT '品牌',
  `brand_item_qty_td` bigint COMMENT '截至今日各品牌商品数量',
  `brand_order_amt_td` decimal(38,6) COMMENT '截至今日各品牌订单金额'
)
comment '各品牌销售分析表'
partitioned by(dt string comment '日期');文档反馈
                    
                    
                    
                    
                 扫码
 扫码 复制
 复制 导出
 导出 
                         
                     
     
     
    
以上内容对您是否有帮助?