finance-dbt/models/dw/schema.yml
沈楠 cb3026dd48
Some checks failed
MJN/finance-dbt/pipeline/head There was a failure building this commit
init: create finance-dbt
2024-04-08 11:50:14 +08:00

292 lines
7.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: 2
models:
- name: dw.dim_exchange
description: "交易所"
columns:
- name: exchange_id
description: "The primary key for this table"
tests:
- unique
- not_null
- name: ts_exchange_code
description: "交易所代码"
tests:
- not_null
- unique
- name: exchange_name
description: "交易所名称"
tests:
- not_null
- unique
- name: dw.dim_date
description: "日期"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- year
- month
- day
columns:
- name: date_id
description: "日期键"
tests:
- unique
- not_null
- name: full_date
description: "日期"
tests:
- not_null
- unique
- name: year
description: "年"
tests:
- not_null
- name: quarter
description: "季度"
tests:
- not_null
- name: month
description: "月"
tests:
- not_null
- name: day
description: "日"
tests:
- not_null
- name: week_num_of_year
description: "年中第几周"
tests:
- not_null
- name: day_num_of_week
description: "星期"
tests:
- not_null
- name: dw.dim_time
description: "时间"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date_id
- hour
- minute
columns:
- name: time_id
description: "时间键"
tests:
- unique
- not_null
- name: full_time
description: "时间"
tests:
- not_null
- unique
- name: date_id
description: "日期键"
tests:
- not_null
- name: hour
description: "小时"
tests:
- not_null
- name: minute
description: "分钟"
tests:
- not_null
- name: dw.dim_hs_calendar
description: "沪深交易日历"
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"
tests:
- not_null
- name: date_id
description: "交易日期键"
tests:
- not_null
- name: is_open
description: "是否交易"
tests:
- not_null
- name: dw.dim_stock
description: "股票"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- exchange_id
- code
columns:
- name: ts_code
description: "tushare 股票编码"
tests:
- unique
- not_null
- name: exchange_id
description: "交易所键"
tests:
- not_null
- name: code
description: "股票代码"
tests:
- not_null
- name: name
description: "股票名称"
tests:
- not_null
- unique
- name: full_name
description: "股票全称"
tests:
- not_null
- unique
- name: name_en
description: "股票英文名称"
tests:
- not_null
- name: cn_spell
description: "拼音缩写"
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: "当前是否在市"
tests:
- not_null
- name: is_hongkong_connect
description: "是否沪深通标的"
tests:
- not_null
- name: actual_controller
description: "实际控制人"
- name: actual_controller_enterprise_type
description: "实际控制人企业类型"
- name: dt
description: "更新时间"
- name: dw.fact_stock_daily
description: "股票日数据"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- ts_code
- date_id
columns:
- name: ts_code
description: "股票键"
tests:
- not_null
- name: date_id
description: "日期键"
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: "股票分钟数据"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- ts_code
- time_id
columns:
- name: ts_code
description: "股票键"
data_type: "String"
tests:
- not_null
- name: time_id
description: "时间键"
data_type: "Int64"
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)"
tests:
- not_null
- name: dt
description: "时间"
data_type: "DateTime"