Analysis-Services/UsqlScripts/Modelling/store_sales.usql

58 lines
1.3 KiB
Plaintext

@raw_parsed = EXTRACT child_id int,
ss_sold_date_sk string,
ss_sold_time_sk string,
ss_item_sk string,
ss_customer_sk string,
ss_cdemo_sk string,
ss_hdemo_sk string,
ss_addr_sk string,
ss_store_sk string,
ss_promo_sk string,
ss_ticket_number string,
ss_quantity string,
ss_wholesale_cost string,
ss_list_price string,
ss_sales_price string,
ss_ext_discount_amt string,
ss_ext_sales_price string,
ss_ext_wholesale_cost string,
ss_ext_list_price string,
ss_ext_tax string,
ss_coupon_amt string,
ss_net_paid string,
ss_net_paid_inc_tax string,
ss_net_profit string,
empty string
FROM "wasb://store-sales@aasuseast2/{*}_{child_id:*}_100.dat"
USING Extractors.Text(delimiter: '|');
@filtered_results = SELECT ss_sold_date_sk,
ss_sold_time_sk,
ss_item_sk,
ss_customer_sk,
ss_cdemo_sk,
ss_hdemo_sk,
ss_addr_sk,
ss_store_sk,
ss_promo_sk,
ss_ticket_number,
ss_quantity,
ss_wholesale_cost,
ss_list_price,
ss_sales_price,
ss_ext_discount_amt,
ss_ext_sales_price,
ss_ext_wholesale_cost,
ss_ext_list_price,
ss_ext_tax,
ss_coupon_amt,
ss_net_paid,
ss_net_profit
FROM @raw_parsed
ORDER BY child_id ASC
FETCH 100 ROWS;
OUTPUT @filtered_results
TO "/modelling/store_sales.csv"
USING Outputters.Csv(outputHeader: true);