Spaces:
Runtime error
Runtime error
| __all__ = ["SCHEMA_NAME", "GPT_SAMPLE_ROWS", "PLATFORM", "SAMPLE_ROW_MAX", "DEFAULT_TABLES_COLS", "QUERY_TIMEOUT"] | |
| #Constants | |
| SCHEMA_NAME = "lpdatamart" | |
| GPT_SAMPLE_ROWS = 1 | |
| PLATFORM = "Amazon Redshift" | |
| SAMPLE_ROW_MAX = 50 | |
| QUERY_TIMEOUT = 20 #timeout in seconds | |
| # list down the desired column | |
| customer_col=['customer_id','customer_type', 'first_name', 'middle_name', 'household_name', 'last_name', 'personal_email', 'city', 'state', 'zip_code', 'address1', 'country', 'gender', 'phone_number', 'reward_number'] | |
| product_col=['product_id', 'product_name', 'product_price', 'department', 'class', 'discount', 'category', 'department_desc', 'department_type', 'product_type', 'manufacturer', 'color'] | |
| sales_col = ['store_id', 'customer_id', 'channel_id', 'product_id', 'time_id', 'date_id','order_id', 'line_action', 'discount_amount', 'shipping_amount','transaction_date', 'transaction_amount', 'transaction_type', 'qty_sold'] | |
| store_col = ['store_id', 'store_number', 'store_name', 'store_designation', 'store_longitude', 'store_latitude', 'store_manager_name', 'zip_code', 'state_code', 'city', 'street_number', 'street_name', 'store_region', 'store_type', 'address1','sublocationcode', 'channel', 'company_flag', 'kiosk_physical_store'] | |
| channel_col = ['channel_id', 'channel_name', 'channel_code'] | |
| lineaction_col = ['line_action_code', 'line_action_code_desc', 'load_date', 'catgory', 'sales_type'] | |
| calendar_col = ['date_id','calendar_month_number','calendar_quarter_number','calendar_date','calendar_month','day_of_week','calendar_week_number','day_of_month','day_of_quarter','day_of_the_year','us_holiday','lp_holiday','work_day','year','ad_week','ad_week_year','ad_month','lp_day','lp_week','lp_month','lp_year','lp_quarter','event_day'] | |
| browse_col = ['cookie_id', 'session_id', 'customer_id', 'email_key', 'reward_number', 'date_id', 'time_id', 'category_id', 'browse_action_id', 'product_id', 'style_id', 'order_id'] | |
| time_col = ['time_id', 'time_of_day'] | |
| browse_action_col = ["browse_action_id", "browse_action"] | |
| browse_category_col = ['category_id', 'category_code', 'category'] | |
| style_col = ["sku", "style", "source_file", "load_date"] | |
| email_col = ['event_id', 'customer_id', 'time_id', 'date_id', 'email_key'] | |
| event_col = ['event_id', 'event_type', 'event_description', 'event_detail', 'start_date', 'end_date', 'event_code', 'event_category'] | |
| tbl_d_product_style_flags = ["product_id", "contemp_style_flag", "trad_style_flag", "country_style_flag", "trans_style_flag", | |
| "mc_style_flag", "farm_style_flag", "wi_style_flag","iron_style_flag","crystal_style_flag","coast_style_flag","rustic_style_flag","ind_style_flag", | |
| "glam_style_flag","ac_style_flag","kids_style_flag","asian_style_flag","tiff_style_flag","trop_style_flag","um_style_flag", | |
| "sw_style_flag", "themed_style_flag", "west_style_flag", "style", "sku#"] | |
| zip_distance = ["zip", "store_number", "mi_from_nearest_store"] | |
| DEFAULT_TABLES_COLS = {"tbl_d_customer":customer_col, "tbl_d_product":product_col, "tbl_f_sales":sales_col, | |
| "tbl_d_store":store_col, "tbl_d_channel":channel_col, "tbl_d_lineaction_code":lineaction_col, | |
| "tbl_d_calendar":calendar_col, 'tbl_f_browse':browse_col, 'tbl_d_time': time_col, 'tbl_d_browse_action': browse_action_col, | |
| 'tbl_d_browse_category':browse_category_col, 'tbl_d_style':style_col, 'tbl_f_emailing': email_col, 'tbl_d_event':event_col, | |
| "tbl_d_product_style_flags":tbl_d_product_style_flags, "zip_distance":zip_distance} | |
| TABLE_RELATIONS = """tbl_d_store and tbl_f_sales on store_id | |
| tbl_d_time and tbl_f_sales on time_id | |
| tbl_d_product and tbl_f_sales on product_id | |
| tbl_d_channel and tbl_f_sales on channel_id | |
| tbl_d_customer and tbl_f_sales on customer_id | |
| tbl_d_source and tbl_f_sales on source_id | |
| tbl_d_calender and tbl_f_sales on date_id | |
| tbl_d_associate and tbl_f_sales on associate_id | |
| tbl_d_promption and tbl_f_sales on promotion_id | |
| tbl_d_keycode and tbl_f_sales on keycode_id | |
| tbl_d_lineaction_code and tbl_f_sales on tbl_d_lineaction_code.line_action_code, tbl_f_sales.line_action | |
| tbl_d_event and tbl_f_emailing on event_id | |
| tbl_d_calender and tbl_f_emailing on date_id | |
| tbl_d_e_sourceid and tbl_f_emailing on email_source_key | |
| tbl_d_time and tbl_f_emailing on time_id | |
| tbl_d_customer and tbl_f_emailing on customer_id | |
| tbl_d_email and tbl_f_email on email_key | |
| tbl_d_email and tbl_d_url on url_id | |
| tbl_f_mailing and tbl_d_calender on date_id | |
| tbl_d_customer and tbl_f_mailing on customer_id | |
| tbl_d_keycode and tbl_f_mailing on keycode_id | |
| tbl_d_email and tbl_f_browse on email_key | |
| tbl_d_calender and tbl_f_browse on date_id | |
| tbl_d_product and tbl_f_browse on product_id | |
| tbl_d_browse_action and tbl_f_browse on browse_action_id | |
| tbl_d_browse_style and tbl_f_browse on browse_style_id | |
| tbl_d_source and tbl_f_activity on source_id | |
| tbl_d_calender and tbl_f_activity on date_id | |
| tbl_d_time and tbl_f_activity on time_id | |
| tbl_d_customer and tbl_f_activity on customer_id | |
| tbl_d_customer and tbl_f_opt_out on customer_id | |
| tbl_d_calender and tbl_f_opt_out on date_id | |
| tbl_d_time and tbl_f_opt_out on time_id | |
| tbl_d_product and tbl_d_product_style_flags on product_id | |
| tbl_d_store and zip_distance on store_number""" | |