finance-dbt/models/dw/schema.yml

305 lines
6.8 KiB
YAML
Raw Permalink Normal View History

2024-04-12 19:07:47 +08:00
version: 2
models:
- name: dw.dim_exchange
description: "交易所"
columns:
- name: exchange_id
description: "The primary key for this table"
2024-07-23 10:33:41 +08:00
data_tests:
- unique
- not_null
- name: ts_exchange_code
description: "交易所代码"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- unique
- name: exchange_name
description: "交易所名称"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- unique
- name: dw.dim_date
description: "日期"
2024-07-23 10:33:41 +08:00
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- year
- month
- day
columns:
- name: date_id
description: "日期键"
2024-07-23 10:33:41 +08:00
data_tests:
- unique
- not_null
2024-07-23 10:33:41 +08:00
- name: date_id_str
description: "日期字符串yyyyMMdd"
data_tests:
- not_null
- unique
- name: full_date
2024-04-12 19:07:47 +08:00
description: "日期"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- unique
- name: year
description: "年"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: quarter
description: "季度"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: month
description: "月"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: day
description: "日"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: week_num_of_year
description: "年中第几周"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: day_num_of_week
description: "星期"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: dw.dim_time
description: "时间"
2024-07-23 10:33:41 +08:00
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date_id
- hour
- minute
columns:
- name: time_id
description: "时间键"
2024-07-23 10:33:41 +08:00
data_tests:
- unique
- not_null
- name: full_time
2024-04-12 19:07:47 +08:00
description: "时间"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- unique
- name: date_id
description: "日期键"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: hour
description: "小时"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: minute
description: "分钟"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: full_time_str
description: "时间字符串yyyy-MM-dd HH:mm:ss"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- unique
- name: date_id_str
2024-07-23 10:33:41 +08:00
description: "日期字符串yyyyMMdd"
data_tests:
- not_null
- name: dw.dim_hs_calendar
description: "沪深交易日历"
2024-07-23 10:33:41 +08:00
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- exchange_id
- date_id
columns:
- name: exchange_id
description: "The primary key for this table"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: date_id
description: "交易日期键"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: is_open
description: "是否交易"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: dw.dim_stock
description: "股票"
2024-07-23 10:33:41 +08:00
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- exchange_id
- code
columns:
- name: ts_code
description: "tushare 股票编码"
2024-07-23 10:33:41 +08:00
data_tests:
- unique
- not_null
- name: exchange_id
description: "交易所键"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: code
description: "股票代码"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: name
description: "股票名称"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- unique
- name: full_name
description: "股票全称"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- unique
- name: name_en
description: "股票英文名称"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: cn_spell
description: "拼音缩写"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: area
description: "地区"
- name: industry
description: "行业"
- name: market
description: "市场类型 (主板/中小板/创业板)"
- name: currency
description: "交易货币"
- name: list_date
description: "上市日期"
- name: delist_date
description: "退市日期"
- name: is_active
description: "当前是否在市"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: is_hongkong_connect
description: "是否沪深通标的"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: actual_controller
description: "实际控制人"
- name: actual_controller_enterprise_type
description: "实际控制人企业类型"
- name: dt
description: "更新时间"
- name: dw.fact_stock_daily
description: "股票日数据"
2024-07-23 10:33:41 +08:00
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- ts_code
- date_id
columns:
- name: ts_code
description: "股票键"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: date_id
description: "日期键"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: open
description: "开盘价"
- name: high
description: "最高价"
- name: low
description: "最低价"
- name: close
description: "收盘价"
- name: pre_close
description: "昨收价"
- name: change
description: "涨跌额"
- name: pct_chg
description: "涨跌幅"
- name: vol
description: "成交量"
- name: amount
description: "成交额"
- name: adj_factor
description: "复权因子"
- name: turnover_rate
description: "换手率"
- name: turnover_rate_free
description: "换手率(自由流通股)"
- name: volume_ratio
description: "量比"
- name: pe
description: "市盈率(总市值/净利润, 亏损的PE为空"
- name: pe_ttm
description: "市盈率TTM"
- name: pb
description: "市净率(总市值/净资产)"
- name: ps
description: "市销率"
- name: ps_ttm
description: "市销率TTM"
- name: dv_ratio
description: "股息率"
- name: dv_ttm
description: "股息率TTM"
- name: total_share
description: "总股本(万股)"
- name: float_share
description: "流通股本(万股)"
- name: free_share
description: "自由流通股本(万)"
- name: total_mv
description: "总市值(万元)"
- name: circ_mv
description: "流通市值(万元)"
- name: dw.fact_stock_minute
description: "股票分钟数据"
2024-07-23 10:33:41 +08:00
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- ts_code
- time_id
columns:
- name: ts_code
description: "股票键"
data_type: "String"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: time_id
description: "时间键"
data_type: "Int64"
2024-07-23 10:33:41 +08:00
data_tests:
- not_null
- name: open
description: "开盘价"
data_type: "Nullable(Decimal(16,2))"
- name: high
description: "最高价"
data_type: "Nullable(Decimal(16,2))"
- name: low
description: "最低价"
data_type: "Nullable(Decimal(16,2))"
- name: close
description: "收盘价"
data_type: "Nullable(Decimal(16,2))"
- name: vol
description: "成交量"
data_type: "Nullable(Int32)"
- name: amount
description: "成交额"
data_type: "Nullable(Decimal(18,2))"
- name: adj_factor
description: "复权因子"
data_type: "Decimal(16,6)"
- name: dt
description: "时间"
data_type: "DateTime"