Analysis-Services/UsqlScripts/last_available_year/customer.usql

47 lines
1.1 KiB
Plaintext
Raw Normal View History

@raw_parsed = EXTRACT child_id int,
c_customer_sk string,
c_customer_id string,
c_current_cdemo_sk string,
c_current_hdemo_sk string,
c_current_addr_sk string,
c_first_shipto_date_sk string,
c_first_sales_date_sk string,
c_salutation string,
c_first_name string,
c_last_name string,
c_preferred_cust_flag string,
c_birth_day string,
c_birth_month string,
c_birth_year string,
c_birth_country string,
c_login string,
c_email_address string,
c_last_review_date string,
empty string
FROM "wasb://customer@<blob storage account name>/{*}_{child_id}_100.dat"
USING Extractors.Text(delimiter: '|');
@filtered_results = SELECT c_customer_sk,
c_customer_id,
c_current_cdemo_sk,
c_current_hdemo_sk,
c_current_addr_sk,
c_first_shipto_date_sk,
c_first_sales_date_sk,
c_salutation,
c_first_name,
c_last_name,
c_preferred_cust_flag,
c_birth_day,
c_birth_month,
c_birth_year,
c_birth_country,
c_login,
c_email_address,
c_last_review_date
FROM @raw_parsed;
OUTPUT @filtered_results
TO "/last_available_year/customer.csv"
USING Outputters.Csv(outputHeader: true);