涉及3个表
CREATE TABLE dim_common_data_permission
(
tenant_id Int              NOT NULL,
user_id   Bigint           NOT NULL,
user_name Varchar(256)     NOT NULL,
market_id Int              NOT NULL,
msku      Varchar(1048576) NOT NULL,
all_flag  Tinyint          NOT NULL
)
COMMENT ‘OLAP’ ENGINE = StarRocks;
CREATE TABLE dws_sales_return_statistics_df
(
etl_time             Datetime      NOT NULL,
tenant_id            Int           NOT NULL,
market_id            Int           NOT NULL,
msku                 Varchar(400)  NOT NULL,
asin                 Varchar(80)   NOT NULL,
statistics_date      Datetime      NOT NULL,
return_reson         Varchar(200)  NOT NULL,
orders               Bigint        NOT NULL,
disposition          Varchar(200)  NOT NULL,
license_plate_number Varchar(2000) NOT NULL,
returns_sellable     Bigint        NOT NULL COMMENT ‘可用退货量’
)
COMMENT ‘OLAP’ ENGINE = StarRocks;
– auto-generated definition
CREATE TABLE dws_sales_operations_df
(
etl_time                   Datetime       NOT NULL,
tenant_id                  Int            NOT NULL,
statistics_date            Datetime       NOT NULL,
market_id                  Int            NOT NULL,
id                         Bigint         NOT NULL,
msku                       Varchar(65533) NOT NULL,
spu                        Varchar(65533) NOT NULL,
asin                       Varchar(65533) NOT NULL,
market_id_msku             Varchar(65533) NOT NULL,
server_id                  Int            NOT NULL,
warehouse_id               Int            NOT NULL,
country                    Int            NOT NULL,
currency                   Varchar(65533) NOT NULL,
product_name               Varchar(65533) NOT NULL,
brand                      Varchar(65533) NOT NULL,
category                   Varchar(65533) NOT NULL,
sku                        Varchar(65533) NOT NULL,
variation_asin             Varchar(65533) NOT NULL,
listing_state              Varchar(65533) NOT NULL,
listing_level              Varchar(65533) NOT NULL,
crawl_title                Varchar(65533) NOT NULL,
first_sales_date           Datetime       NOT NULL,
add_date                   Datetime       NOT NULL,
update_date                Datetime       NOT NULL,
create_time                Datetime       NOT NULL,
order_product_sales        Decimal(20, 8) NOT NULL,
order_product_sales_b2b    Decimal(20, 8) NOT NULL,
orders                     Int            NOT NULL,
order_items                Int            NOT NULL,
order_items_b2b            Int            NOT NULL,
units_ordered              Int            NOT NULL,
units_ordered_b2b          Int            NOT NULL,
units_ordered_traffic      Int            NOT NULL,
patch_units_ordered        Int            NOT NULL,
multi_channel_orders       Int            NOT NULL,
refunds                    Int            NOT NULL,
returns                    Int            NOT NULL,
returns_sellable           Int            NOT NULL,
returns_purchase_cost      Decimal(20, 8) NOT NULL,
returns_arrive_cost        Decimal(20, 8) NOT NULL,
refund_cost                Decimal(20, 8) NOT NULL,
return_product_sales       Decimal(20, 8) NOT NULL,
refund_discount_cost       Decimal(20, 8) NOT NULL,
refund_tax_cost            Decimal(20, 8) NOT NULL,
order_ids                  Varchar(65533) NOT NULL,
ads_impressions            Int            NOT NULL,
ads_clicks                 Int            NOT NULL,
ads_orders                 Int            NOT NULL,
ads_item_orders            Int            NOT NULL,
ads_sales                  Decimal(20, 8) NOT NULL,
ads_item_sales             Decimal(20, 8) NOT NULL,
ads_spend                  Decimal(20, 8) NOT NULL,
sessions                   Int            NOT NULL,
page_views                 Int            NOT NULL,
buy_box_percentage         Decimal(12, 2) NOT NULL,
commission_cost            Decimal(20, 8) NOT NULL,
shipping_cost              Decimal(20, 8) NOT NULL,
fba_shipping_cost          Decimal(20, 8) NOT NULL,
shipping_charge            Decimal(20, 8) NOT NULL,
discount_cost              Decimal(20, 8) NOT NULL,
amazon_tax                 Decimal(20, 8) NOT NULL,
others_cost                Decimal(20, 8) NOT NULL,
purchase_cost              Decimal(20, 8) NOT NULL,
arrive_cost                Decimal(20, 8) NOT NULL,
product_shipping_cost      Decimal(20, 8) NOT NULL,
vat_cost                   Decimal(20, 8) NOT NULL,
sales_gross_profit         Decimal(20, 8) NOT NULL,
sales_net_profit           Decimal(20, 8) NOT NULL,
patch_amazon_cost          Decimal(20, 8) NOT NULL,
patch_purchase_cost        Decimal(20, 8) NOT NULL,
patch_arrive_cost          Decimal(20, 8) NOT NULL,
patch_cost                 Decimal(20, 8) NOT NULL,
multichannel_amazon_cost   Decimal(20, 8) NOT NULL,
multichannel_purchase_cost Decimal(20, 8) NOT NULL,
multichannel_arrive_cost   Decimal(20, 8) NOT NULL,
multichannel_cost          Decimal(20, 8) NOT NULL,
bogus_orders               Int            NOT NULL,
bogus_quantity             Int            NOT NULL,
bogus_sales_cost           Decimal(20, 8) NOT NULL,
bogus_others_cost          Decimal(20, 8) NOT NULL,
bogus_discount_cost        Decimal(20, 8) NOT NULL,
bogus_purchase_cost        Decimal(20, 8) NOT NULL,
bogus_arrive_cost          Decimal(20, 8) NOT NULL,
bogus_vat_cost             Decimal(20, 8) NOT NULL,
bogus_principal_price      Decimal(20, 8) NOT NULL,
bogus_price                Decimal(20, 8) NOT NULL,
storage_fee                Decimal(20, 8) NOT NULL,
platform_fee               Decimal(20, 8) NOT NULL,
total_revenue              Decimal(20, 8) NOT NULL,
total_spend                Decimal(20, 8) NOT NULL,
product_manager_account    Varchar(65533) NOT NULL,
product_manager_account_id Int            NOT NULL,
purchase_account           Varchar(65533) NOT NULL,
purchase_account_id        Int            NOT NULL,
selling_manager_name       Varchar(65533) NOT NULL,
selling_manager_id         Int            NOT NULL,
sessions_asin              Int            NOT NULL,
page_views_asin            Int            NOT NULL,
buy_box_percentage_asin    Decimal(12, 2) NOT NULL,
origin                     Tinyint        NOT NULL,
cost_origin                Varchar(65533) NOT NULL
)
COMMENT ‘OLAP’ ENGINE = StarRocks;